[HACK] Displaying subpage links in parent page body

For articles specific to version 6.x
Post Reply
Brandeline
Posts: 76
Joined: Thu Sep 16, 2010 4:12 am

[HACK] Displaying subpage links in parent page body

Post by Brandeline »

This has always bugged me about the way subpages are implemented in ISC.

PROBLEM:
I have a root level page in the main menu called Resources, and its purpose is really just to provide a placeholder label on my menu for a lot of informational charts and reference materials as its sub-pages.

Unfortunately, due to the hinky way the menus are designed, anything in the menus has to actually exist as a page, which means that people can actually select 'Resources' instead of one of its sub-pages. I don't really have separate content for the resources page so the one real sensible thing that ought to be on that page body is a list of links to the sub-pages under that heading. ISC does not really give you a way to do this.

I know they put subpages in the side menu, but frankly, they are hard to see over there, and it still leaves the main body of the page with just a title, and a page full of empty. I suppose you could also go manually and recreate the whole list of links in the content section of the parent page, but that's a ridiculous amount of work for something you should be able to get out of the database dynamically. And every time you add a page, you'd have to remember to manually edit the parent page with a new link.

So here is my solution. All work was completed on 6.1.1. I can't guarantee this will work exactly this way on earlier versions.

HACK:

1. Find page.html in the templates/_master directory and copy it to your chosen template design's directory and renamed it as _pageCategoryLinks.html

2. Open the newly renamed _pageCategoryLinks.html file and remove %%Panel.SideSubPageList%% from the Left layout div.

3. In the main body content div add %%Panel.TopSubPageList%% right under %%Panel.PageContent%%

4. Go to the panels in templates/_master/Panels and copy SidePageList.html to the Panels directory of your template design's Panels directory and rename it TopPageList.html

5. Go to the /includes/display directory of your installation and copy SidePageList.php as a new file named TopPageList.php in the same directory.

6. Open TopPageList.php and change the class name in the declaration at the top about line 3 to

Code: Select all

CLASS ISC_TOPSUBPAGELIST_PANEL extends PANEL
7. On Line 69 comment out the whole line with //:

Code: Select all

//$GLOBALS['PageTitle'] = isc_html_escape($GLOBALS['ISC_CLASS_PAGE']->GetPageTitle());
(This will stop the page name from being displayed a second time as a heading on the page.)

If your template design replaced any of the above template layout files with it's own, then make changes from the copy in your templates/<template name> directory instead.

Now, when you want to have a page with just a menu of links to it's subpages, select the _pageCategoryLinks.html file as your page template in the page editor interface. If you want to add some content above the links, you still can.
Post Reply