Support Forums

Displaying particular pages in Accordion menu

This is a discussion on Displaying particular pages in Accordion menu within the TemplateCodes forums, part of the Third Party Support category; Hi Guys, me again. My better half would like specific pages showing in the accordion menu. I figured that I ...


Go Back   68 Classifieds Forums > Third Party Support > TemplateCodes

Reply
 
Thread Tools Display Modes
Old 09-14-2009, 10:59 AM   #1
Customer
 
Join Date: Feb 2009
Location: Hong Kong
Posts: 30
Rep Power: 11
skekum is on a distinguished road
Default Displaying particular pages in Accordion menu

Hi Guys, me again.

My better half would like specific pages showing in the accordion menu. I figured that I could restrict it to display just a range of page id's.

I have the code:
Code:
{foreach from=$templatepages item="entry"}
	<li><a class="page" href="{$smarty.const.URL}/pages.php?pg={$entry.pURI}">{$entry.pPageTitle}</a></li>
{/foreach}
Which I understand as fetching an array of all the pages.

I tried wrapping this in an IF statement but can't get it to work properly. I can get it to recognise the array (with the IF), but are having trouble being able to identify the page ID's. Here's what I had as a test:
Code:
{if is_array($templatepages.pageID) == "17"}
{foreach from=$templatepages item="entry"}
	<li><a class="page" href="{$smarty.const.URL}/pages.php?pg={$entry.pURI}">{$entry.pPageTitle}</a></li>
{/foreach}
{/if}
If you can stop laughing, I was taking a stab in the dark about how to reference the page ID, and only show the page that has the ID of "17". I actually want pages 17-23 inclusive, but was just trying to get it to work correctly first.

Am I even close?

Glenn
__________________
68 Classifieds Developer v4.1.10

Template - Fluid-Ocean
Modules - adpack, debug, freecap, image_upload, listingfilter, maintenance, markitup, payment_providers, quick_search, statistics, tc_jcarousel, tc_site_map, template_switcher, templatezones.

http://www.themarketplace.com.hk
skekum is offline   Reply With Quote
Old 09-14-2009, 11:02 AM   #2
Customer
 
Join Date: Feb 2009
Location: Hong Kong
Posts: 30
Rep Power: 11
skekum is on a distinguished road
Default

Just to add, I know I could "hard code" the pages I want in, but i'm trying to get a better understanding of smarty and make the code cleaner.

Glenn
__________________
68 Classifieds Developer v4.1.10

Template - Fluid-Ocean
Modules - adpack, debug, freecap, image_upload, listingfilter, maintenance, markitup, payment_providers, quick_search, statistics, tc_jcarousel, tc_site_map, template_switcher, templatezones.

http://www.themarketplace.com.hk
skekum is offline   Reply With Quote
Old 09-14-2009, 11:16 AM   #3
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,489
Rep Power: 135
Eric Barnes is just really nice Eric Barnes is just really nice
Default

I think you need to do it this way:
Code:
{foreach from=$templatepages item="entry"}
    {if $entry.pageID==17}
    <li><a class="page" href="{$smarty.const.URL}/pages.php?pg={$entry.pURI}">{$entry.pPageTitle}</a></li>
    {/if}
{/foreach}
or

Code:
{foreach from=$templatepages item="entry"}
    {if $entry.pageID==17 || $entry.pageID==18 || $entry.pageID==19}
    <li><a class="page" href="{$smarty.const.URL}/pages.php?pg={$entry.pURI}">{$entry.pPageTitle}</a></li>
    {/if}
{/foreach}
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 09-14-2009, 11:33 AM   #4
Customer
 
Join Date: Feb 2009
Location: Hong Kong
Posts: 30
Rep Power: 11
skekum is on a distinguished road
Default

Thanks Eric, that worked great.

I was sooo close.

I thought that once the FOREACH statement had already called the array (and so built it), it couldn't be restricted after that.

Thanks for the lesson�and being so quick at responding.

Glenn
__________________
68 Classifieds Developer v4.1.10

Template - Fluid-Ocean
Modules - adpack, debug, freecap, image_upload, listingfilter, maintenance, markitup, payment_providers, quick_search, statistics, tc_jcarousel, tc_site_map, template_switcher, templatezones.

http://www.themarketplace.com.hk
skekum is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display Sub Category in Accordion hel68c Modules / Plugins / Modifications 7 01-10-2010 06:28 AM
Delete menu bar on top of pages adexinc Technical Support 2 08-26-2009 12:53 PM
Accordion menu item if user logged in skekum TemplateCodes 2 08-20-2009 08:41 AM
Hi, I have my categories listed in a side menu appearing in all pages and I want to h newcastledirectory TemplateCodes 4 08-07-2009 06:12 AM
Displaying the number of items in the cat for the dropdown menu bowers01 Technical Support 4 07-23-2008 06:37 PM


All times are GMT -4. The time now is 11:08 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0