Hack: Section - Table, Category - Blog

Moderator: mcsmom

Post Reply
User avatar
cronlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sun Aug 28, 2005 1:19 pm
Location: Noel, MO
Contact:

Hack: Section - Table, Category - Blog

Post by cronlin » Wed Sep 14, 2005 4:48 pm

If you want to have a link for your Section's categories in table format, then your categories displayed in blog format, here's the hack submitted by barnett @ mambo server forums

It only requires editing two files. And the Breadcrumbs and titles will be as you want them. (The only thing that doesn't work is the ability to set the page title to whatever you want since it reads the Category Name field.)

First File to edit is on the frontend: content.php

Found at: components/com_content/content.php

goto line# 461 in the ShowCategory function and replace this:

Code: Select all

HTML_content::showContentList( $category, $items, $access, $id, $sectionid, $gid, $params, $pageNav, $other_categories, $lists );


with this:

Code: Select all

$params->def( 'blog_link', 0 );
   if ( $params->get( 'blog_link' ) ) {
      global $pop;
      showBlogCategory( $id, $gid, $access, $pop, $now );
   } else {
      HTML_content::showContentList( $category, $items, $access, $id, $sectionid, $gid, $params, $pageNav, $other_categories, $lists );
   }


next scroll down to the blank space on line# 788 (which may have changed to 794)

enter in this code between the case statements:

case 'content_blog_category':
$description = new mosCategory( $database );
$description->load( $menu->componentid );
break;

//Insert New Code HERE **************

default:
$menu->componentid = 0;
break;

Code: Select all

case 'content_section':
            $description = new mosCategory( $database );
            $description->load( $id );
            // Dynamic Page Title
            $mainframe->SetPageTitle( $description->name );
            if ( $header ) { $header = $description->name; }
            break;


Save the file and replace the old one.


The next file is in the backend: content_section.xml

found at: administrator/components/com_menus/content_section/content_section.xml

after line# 113 enter in this:

Code: Select all

<param name="@spacer" type="spacer" default="" label="" description="" />
      <param name="@spacer" type="spacer" default="" label="Blog Category Hack Below" description="" />
      <param name="blog_link" type="radio" default="0" label="Link to Blog Categories" description="Make the Category link to a blog instead of a table">
         <option value="0">No</option>
         <option value="1">Yes</option>
      </param>
      <param name="@spacer" type="spacer" default="" label="" description="" />
      <param name="header" type="text" size="30" default="" label="Page Title" description="Text to display at the top of the page" />
      <param name="page_title" type="radio" default="1" label="Page Title" description="Show/Hide the Page title">
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="leading" type="text" size="3" default="1" label="# Leading" description="Number of Items to display as a leading (full width) item. 0 will mean that no items will be displayed as leading." />
      <param name="intro" type="text" size="3" default="4" label="# Intro" description="Number of Items to display with the introduction text shown." />
      <param name="columns" type="text" size="3" default="2" label="Columns" description="When displaying the intro text, how many columns to use per row" />
      <param name="link" type="text" size="3" default="4" label="# Links" description="Number of Items to display as Links." />
      <param name="orderby_pri" type="list" default="" label="Category Order" description="Order items by catgeory">
         <option value="">No, order by Primary Order only</option>
         <option value="alpha">Title Alphabetical</option>
         <option value="ralpha">Title Reverse-Alphabetical</option>
         <option value="order">Ordering</option>
      </param>
      <param name="orderby_sec" type="list" default="" label="Primary Order" description="Order that the items will be displayed in.">
         <option value="">Default</option>
         <option value="date">Oldest first</option>
         <option value="rdate">Most recent first</option>
         <option value="alpha">Title Alphabetical</option>
         <option value="ralpha">Title Reverse-Alphabetical</option>
         <option value="author">Author Alphabetical</option>
         <option value="rauthor">Author Reverse-Alphabetical</option>
         <option value="hits">Most Hits</option>
         <option value="rhits">Least Hits</option>
         <option value="order">Ordering</option>
      </param>
      <param name="pagination" type="list" default="2" label="Pagination" description="Show/Hide Pagination support">
         <option value="0">Hide</option>
         <option value="1">Show</option>
         <option value="2">Auto</option>
      </param>
      <param name="pagination_results" type="radio" default="1" label="Pagination Results" description="Show/Hide Pagination Results info ( e.g 1-4 of 4 )">
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="image" type="radio" default="1" label="MOSImages" description="Display {mosimages}.">
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="@spacer" type="spacer" default="" label="" description="" />
       <param name="category" type="radio" default="0" label="Category Name" description="Show/Hide the Category the item belongs to">
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="category_link" type="radio" default="0" label="Category Name Linkable" description="Make the Category text a link to the actual Category page">
         <option value="0">No</option>
         <option value="1">Yes</option>
      </param>
      <param name="item_title" type="radio" default="1" label="Item Titles" description="Show/Hide the items title">
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="link_titles" type="list" default="" label="Linked Titles" description="Make your Item titles linkable">
         <option value="">Use Global</option>
         <option value="0">No</option>
         <option value="1">Yes</option>
      </param>
      <param name="readmore" type="list" default="" label="Read More" description="Show/Hide the Read More link">
         <option value="">Use Global</option>
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>   
      <param name="rating" type="list" default="" label="Item Rating" description="Show/Hide the item rating - only affects this page">
         <option value="">Use Global</option>
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="author" type="list" default="" label="Author Names" description="Show/Hide the item author - only affects this page">
         <option value="">Use Global</option>
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="createdate" type="list" default="" label="Created Date and Time" description="Show/Hide the item creation date - only affects this page">
         <option value="">Use Global</option>
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="modifydate" type="list" default="" label="Modified Date and Time" description="Show/Hide the item modification date - only affects this page">
         <option value="">Use Global</option>
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="pdf" type="list" default="" label="PDF Icon" description="Show/Hide the item pdf button - only affects this page">
         <option value="">Use Global</option>
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="print" type="list" default="" label="Print Icon" description="Show/Hide the item print button - only affects this page">
         <option value="">Use Global</option>
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
      <param name="email" type="list" default="" label="Email Icon" description="Show/Hide the item email button - only affects this page">
         <option value="">Use Global</option>
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>


Save and replace over the old file

Now just log into the admin backend and goto the menu item that is your Table-Content Section and edit it. you'll see the blog Category options at the bottom of the Parameters. select Link to Blog Categories: yes and you'll be set to jet!!!

This looks like a lot, but believe me, if I can do it, you can too! :D

Good luck!
Last edited by kenmcd on Sat Oct 29, 2005 12:13 pm, edited 1 time in total.
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!

User avatar
cronlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sun Aug 28, 2005 1:19 pm
Location: Noel, MO
Contact:

Re: Section- Table, Category - Blog

Post by cronlin » Wed Sep 14, 2005 4:56 pm

to see a live demo  visit www.timo-aim.com and click on "TIMO Teams" menu item to see the hack in action. Currently there is only one article per BlogCategory and the  link to the individual articles is turned off in the parameters, but the hack is working fine.

some people are also having problems with 4.5.2.3, but barnett had no difficulties with his site, and neither am I with mine
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!

juliecracker

Re: Hack: Section - Table, Category - Blog

Post by juliecracker » Sat Mar 25, 2006 9:33 pm

I just wanted to say thanks!  This is exactly what I've been looking for to use in two of my sites - I'm so happy!

(Not extensively tested yet, but seems to work great in Joomla 1.0.7 and 1.0.8 )

j
Last edited by juliecracker on Mon Apr 03, 2006 1:49 am, edited 1 time in total.

robfurrball

Re: Hack: Section - Table, Category - Blog

Post by robfurrball » Wed Apr 12, 2006 8:38 pm

It seems like the showcontentlist function needs to have the following inserted directly after '$lists': ',$selected' (without quotes).  This prevents an error from popping up saying the wrong number of args are specified.

Thanks!  I like the way it works.

navin123

Re: Hack: Section - Table, Category - Blog

Post by navin123 » Sun Apr 23, 2006 7:32 am

I'm still confused as to what it really does. ??? I check the samlple link but seemed normal Joomla to me.

User avatar
barnett
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Aug 19, 2005 12:52 pm
Location: Nyack, NY

Re: Hack: Section - Table, Category - Blog

Post by barnett » Tue Aug 29, 2006 4:17 pm

I'm surprised how this hack has held up over the new versions of Joomla.  Here is a correction needed for use of this hack with Joomla 1.0.11.

In step 0ne

Found at: components/com_content/content.php

goto the ShowCategory function and replace this (near the bottom of the function):

Code: Select all

HTML_content::showContentList( $category, $items, $access, $id, $sectionid, $gid, $params, $pageNav, $other_categories, $lists, $selected );



with this:

Code: Select all

$params->def( 'blog_link', 0 );
if ( $params->get( 'blog_link' ) ) {
   global $pop;
   showBlogCategory( $id, $gid, $access, $pop, $now, $limit, $limitstart );
} else {
   HTML_content::showContentList( $category, $items, $access, $id, $sectionid, $gid, $params, $pageNav, $other_categories, $lists, $selected );
}


that should do it.  All the rest is the same.  Thanks.
-barnett
Coming Soon: http://www.contemplatejoomla.com/ - Smart Components, Modules, and Plugins

Coming Soon: http://www.contemplatedesign.com/ - Smart Joomla Template Designs

User avatar
cronlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sun Aug 28, 2005 1:19 pm
Location: Noel, MO
Contact:

Re: Hack: Section - Table, Category - Blog

Post by cronlin » Tue Aug 29, 2006 5:36 pm

navin123 wrote:I'm still confused as to what it really does. ??? I check the samlple link but seemed normal Joomla to me.


this hack allows you to display your items in blog format while the menu items are in table format..... example:  you have a section called cars and that section has 3 categories: ford, chevy, dodge.  Each category has at least 3 items like ford has f150, mustang, and taurus while chevy has the impala, cavalier, and s10 and dodge has the ram, durango, and stratus.  You want your menu to target the section so that your readers can select which make of the vehicle they want to see, but when they click on say ford....it shows every article in a blog format instead of then they have to choose which item they want to read.....

does that make sense?
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!

User avatar
cronlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sun Aug 28, 2005 1:19 pm
Location: Noel, MO
Contact:

Re: Hack: Section - Table, Category - Blog

Post by cronlin » Thu Sep 21, 2006 11:42 am

omg, i just can't seem to get what's going on, but as I finished up on the hack for joomla 1.0.11 i'm getting this error in my frontend

Parse error: syntax error, unexpected $end in /home/www/easy-peasy.awardspace.com/components/com_content/content.php on line 2355

my backend is fine and the hack actually displays as it should in the administration area...

here's the weird part: line 2355 is the php end tag for the entire page

?> 

how on earth is that an unexpected $end?  any ideas at all would really help
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!

User avatar
barnett
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Aug 19, 2005 12:52 pm
Location: Nyack, NY

Re: Hack: Section - Table, Category - Blog

Post by barnett » Thu Sep 21, 2006 12:42 pm

cronlin wrote:omg, i just can't seem to get what's going on, but as I finished up on the hack for joomla 1.0.11 i'm getting this error in my frontend

Parse error: syntax error, unexpected $end in /home/www/easy-peasy.awardspace.com/components/com_content/content.php on line 2355

my backend is fine and the hack actually displays as it should in the administration area...

here's the weird part: line 2355 is the php end tag for the entire page

?> 

how on earth is that an unexpected $end?  any ideas at all would really help


Usually I get that error when I've accidentally deleted a php $end tag ( ?> ) earlier in the code.  I would check the ShowCategory function where you did the hack to make sure you didn't delete the ?> tag that ends the function since the code you're replacing is near the end tag there.  Just a thought.  Hope you work it out.

-barnett
Coming Soon: http://www.contemplatejoomla.com/ - Smart Components, Modules, and Plugins

Coming Soon: http://www.contemplatedesign.com/ - Smart Joomla Template Designs

User avatar
cronlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sun Aug 28, 2005 1:19 pm
Location: Noel, MO
Contact:

Re: Hack: Section - Table, Category - Blog

Post by cronlin » Thu Sep 21, 2006 7:17 pm

well, I feel like an idiot... but just so no one else makes the same mistake, this is what I did

in the ShowCategory function it has this:

HTML_content::showContentList( $category, $items, $access, $id, $sectionid, $gid, $params, $pageNav, $other_categories, $lists );
}
} // showCategory

I had replaced it, leaving out one }  and that's what the problem stemmed from....

thanks barnett for a really quick reply, it certainly doesn't help that I'd been working on my site non-stop for many many hours and it was very early in the morning when my mind never functions like it's supposed to :D
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!

User avatar
eyezberg
Joomla! Engineer
Joomla! Engineer
Posts: 263
Joined: Thu Aug 25, 2005 5:48 pm
Location: Geneva mostly
Contact:

Re: Hack: Section - Table, Category - Blog

Post by eyezberg » Sun Oct 01, 2006 7:36 am

cronlin, nice site you got there, hope you find some people!
I also fail to see what this hack does, as I haven't really tried to understand,
but it looks good on your site, whatever it is :)
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.blogspot.com for J! 1.5 screenshots
http://www.eyezberg.com

User avatar
cronlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sun Aug 28, 2005 1:19 pm
Location: Noel, MO
Contact:

Re: Hack: Section - Table, Category - Blog

Post by cronlin » Mon Oct 02, 2006 5:52 am

eyezberg wrote:cronlin, nice site you got there, hope you find some people!
I also fail to see what this hack does, as I haven't really tried to understand,
but it looks good on your site, whatever it is :)


This is what I usually use the hack for.

I have a section called avatars.  Within that section are several different categories:  new, games, battledome, etc. Within each category are numerous content items that I want to be shown all at once.  By using this hack, I have the menu link for the section called Avatars. When clicked, it displays the category's in table format so that the user can select which type of avatars they would like to browse. When they make their selection, this hack displays every single content item in that category in blog format to see them all at once instead of just one at a time. Does that make sense?  I'll actually have another example up soon, I'm working on it at the moment and thanks for the compliment on my site, but I'm having to switch hosts again because this one now wants me to pay for it when it was offered for free and right now I'm too cheap (4 kids and all)  :)

Modified 12-16-06
I just added this hack back to my site (I had to overwrite my files with the originals since my host made some upgrades) and this time I was having some problems with it.  When I had specified to show a certain number of items, it would display a "you are not authorized to view this resource" for every item that was over the default number of items... I had the default number set at 50 as that was the highest allowed, so anything over 50 showed that message, though the pagination was still there for the items that went over 50

to correct this, I edited my file content.section.xml and added several options to the default items... I added an option for 100, 200, 500, and 1000 just to be on the safe side. As soon as I added that, I refreshed the menu item with the parameters and increased the default number to 1000 (like I said, just to be safe) then set my hack parameters to whatever I wanted and they were all displayed as they should.

To see this hack in action, check out my site Neopets Made Easy.  Click on the Main Menu link for Avatars. You can then select the category of Avatars that you want to see and when you do, every single item in my category will be shown in blog format.
Last edited by cronlin on Sun Dec 17, 2006 12:44 am, edited 1 time in total.
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!

orthonet
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Sep 08, 2005 11:01 pm

Re: Hack: Section - Table, Category - Blog

Post by orthonet » Thu Jan 04, 2007 12:54 am

I tried doing this hack on a Joomla 1.012 installation and am receiving the following error when I go to a menu item that is a List Section and try to load it to turn on the parameters. Also happens if I try to create a new menu item that is a List section. The page that loads has no css style to it. Its a white background, no top header, no menu. It just loads the left hand form and then the error on the right where the tabs should be.

Parameters

Fatal error: Call to undefined function: getattribute() in /var/home/coa-aco/coa-aco.org/www/includes/joomla.xml.php on line 273

Ideas?


Pertinent lines in Joomla.xml.php are

Code: Select all

   $name = $param->getAttribute( 'name' );
      $label = $param->getAttribute( 'label' );


Best regards

Christian

orthonet
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Sep 08, 2005 11:01 pm

Re: Hack: Section - Table, Category - Blog

Post by orthonet » Thu Jan 04, 2007 12:57 am

Apologies for the false alarm.

Code seems to work.

I made a blunder by having a comment about the mod in the xml file.
Duh.

:-)

Christian

User avatar
eyezberg
Joomla! Engineer
Joomla! Engineer
Posts: 263
Joined: Thu Aug 25, 2005 5:48 pm
Location: Geneva mostly
Contact:

Re: Hack: Section - Table, Category - Blog

Post by eyezberg » Thu Jan 04, 2007 9:53 pm

Nice, now I understand :)
But with 100+ items, that becomes a very long page..
Maybe pagination and a param for X itmes / page ..?
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.blogspot.com for J! 1.5 screenshots
http://www.eyezberg.com

User avatar
cronlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sun Aug 28, 2005 1:19 pm
Location: Noel, MO
Contact:

Re: Hack: Section - Table, Category - Blog

Post by cronlin » Thu Jan 04, 2007 10:22 pm

the pagination and such is personal preference... I personally do not want my guests to have to hunt through pages upon pages of the same thing.... that's why I chose to add every single article (which are small to begin with) but I did have to hack a core file in order to accomplish that

whatever your global settings are for your default items will be the default items on your blog as well, with the pagination at the bottom as on every other page

if you want more than 50 items to display, like I do, you'll have to edit the core file to add more options to the drop down list to enable more to be shown
Last edited by cronlin on Thu Jan 04, 2007 10:24 pm, edited 1 time in total.
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!

goocharlton
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Jul 06, 2006 6:18 am
Contact:

Re: Hack: Section - Table, Category - Blog

Post by goocharlton » Thu Jan 11, 2007 9:50 pm

orthonet wrote:I tried doing this hack on a Joomla 1.012 installation and am receiving the following error when I go to a menu item that is a List Section and try to load it to turn on the parameters. Also happens if I try to create a new menu item that is a List section. The page that loads has no css style to it. Its a white background, no top header, no menu. It just loads the left hand form and then the error on the right where the tabs should be.

Parameters

Fatal error: Call to undefined function: getattribute() in /var/home/coa-aco/coa-aco.org/www/includes/joomla.xml.php on line 273

Ideas?


Pertinent lines in Joomla.xml.php are

Code: Select all

   $name = $param->getAttribute( 'name' );
      $label = $param->getAttribute( 'label' );


Best regards

Christian


When i did it on Joomla 1.0.12 i didn't receive an error but i do have a problem.

Nothing changed.
I have attached the 2 files that i edited, have i done something wrong or what??

P.S They are .txt files because i cant attach .php or .xml files
Attachments
content_section.txt
(13.38 KiB) Downloaded 6 times
content.txt
(76.5 KiB) Downloaded 7 times

User avatar
cronlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sun Aug 28, 2005 1:19 pm
Location: Noel, MO
Contact:

Re: Hack: Section - Table, Category - Blog

Post by cronlin » Wed Jan 17, 2007 9:28 pm

I've seen where a lot of people are having issues after upgrading to 1.0.12 so I'm kinda putting it off -  it was released right in the middle of me adding a forum and such so I'm very very leary and not looking forward to having to re-edit all these files that I've had to change already :D
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!

User avatar
barnett
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Aug 19, 2005 12:52 pm
Location: Nyack, NY

Re: Hack: Section - Table, Category - Blog

Post by barnett » Mon Jan 29, 2007 5:00 am

goocharlton wrote:When i did it on Joomla 1.0.12 i didn't receive an error but i do have a problem.

Nothing changed.
I have attached the 2 files that i edited, have i done something wrong or what??

P.S They are .txt files because i cant attach .php or .xml files


@goocharlton & everyone

I've updated this hack to work with Joomla 1.0.12 as well as fix the category description images bug on the content section pages.

I've posted this hack in a new thread here: http://forum.joomla.org/index.php/topic,135919.0.html

so please continue discussion there where I can monitor it better.

-barnett
Coming Soon: http://www.contemplatejoomla.com/ - Smart Components, Modules, and Plugins

Coming Soon: http://www.contemplatedesign.com/ - Smart Joomla Template Designs

User avatar
cronlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sun Aug 28, 2005 1:19 pm
Location: Noel, MO
Contact:

Re: Hack: Section - Table, Category - Blog

Post by cronlin » Thu Feb 01, 2007 6:33 pm

thanks barnett for updating this so frequently for everyone! I use this hack for several different categories now and I don't know what I would do without it!
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!


Post Reply