Support Forums

Could really do with some SMARTY help!

This is a discussion on Could really do with some SMARTY help! within the Templates, HTML, CSS, and Design Help forums, part of the General category; I would like to modify and place a static menu for some categories I have managed to use the code: ...


Go Back   68 Classifieds Forums > General > Templates, HTML, CSS, and Design Help

Reply
 
Thread Tools Display Modes
Old 05-02-2010, 09:27 PM   #1
Customer
 
Join Date: May 2010
Posts: 9
Rep Power: 0
ThinkBusiness is on a distinguished road
Lightbulb Could really do with some SMARTY help!

I would like to modify and place a static menu for some categories I have managed to use the code:

{if $smarty.server.REQUEST_URI == "/bars.html"}

My static menu

{else}

The normal dynamic menu

{/if}

Is it possible at all to make {if $smarty.server.REQUEST_URI == "/bars.html"} apply to all the pages in the "bars" category?

At the moment this is great for the category index page but not for the pages within the "bars" category, there must be a way to instruct this rule for all pages within that category, right?

If only I could specify this rule to whole categories it would solve many of my problems. I would really appreciate anyone's comments.

I have just installed Eric's brilliant categories module but if only there was one like it for the layout and listings that would be simply amazing.

I have the SEO module installed if that makes any difference!

Thanks guys!
ThinkBusiness is offline   Reply With Quote
Old 05-02-2010, 10:11 PM   #2
Developer & Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,311
Rep Power: 69
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

It would seem to me that you need to base your If logic on a different criteria. If it were me, I would look for the common smarty variable for any of those pages by invoking the {debug} and looking at the variables available in some of those pages. It's probably going to be something like $section or $type, I can't remember off the top of my head.

Put {debug} as the very first thing in your layout.tpl file. Make sure that you de-activate any pop up blockers that you may have for you browser. Then simply visit any of those pages. For each page you visit a separate pop up window will come up and will list every variable available to the template page.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 05-03-2010, 06:48 PM   #3
Customer
 
Join Date: May 2010
Posts: 9
Rep Power: 0
ThinkBusiness is on a distinguished road
Default Slug value?

Thanks Mike I am making progress here, but my code does not seem to work according to my limited knowledge and logic I think it should! I actually want a whole category slug "bars" to display my code so I have come up with:

{if $slug == "bars"}

My static menu

{else}

The normal menu

{/if}

I am not sure if I am using this slug value correctly I suspect not! Any further comments would be very much welcomed!
ThinkBusiness is offline   Reply With Quote
Old 05-03-2010, 06:55 PM   #4
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Where are you getting the $slug from?
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 05-03-2010, 07:06 PM   #5
Customer
 
Join Date: May 2010
Posts: 9
Rep Power: 0
ThinkBusiness is on a distinguished road
Default

The slug is listed in {$data} I believe, it is in an array:

4 => Array (11)
id => "12"
parent_id => "0"
name => "Bars"
slug => "bars"
description => "The Bars"
image => "templates/iglv2/images/folder.gif"
allowads => "Y"
cLink => ""
start_link => "<a href="categories/bars.html" title..."
subcats => ""
total => "0"

This pops up using the {debug} on the categories page.
ThinkBusiness is offline   Reply With Quote
Old 05-03-2010, 07:38 PM   #6
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

I think you need to more clearly understand not only arrays but variables and where they exist to accomplish your goals.

The slug is listed in data which is an array but more specifically does it exist on the page where you want your custom menu to be displayed instead of the default menu? More specifically, when you are viewing the bars category is there a variable (array or otherwise) that is unique to that category that you can use? Is "slug" displayed in the debug console when you are viewing a page in the category "bars"?

Next, you cant just put $slug down if its a key within an array. If you have multiple categories then the $data array will contain multiple "slug" keys, you need to define which one to use in your logic.
__________________
Larry

Knowledge learned is more valuable than knowledge given.

Last edited by Lhotch; 05-03-2010 at 07:50 PM.
Lhotch is offline   Reply With Quote
Old 05-03-2010, 08:19 PM   #7
Customer
 
Join Date: May 2010
Posts: 9
Rep Power: 0
ThinkBusiness is on a distinguished road
Default

Thanks Larry!

Actually all I need is to display this menu and remove a couple of design elements in the showlistings template for any listing contained in the bars category.

I have added the debug command but I am not getting any pop up when viewing an entry.

Perhaps I should seek some professional help here, would anyone have have some time to assist me further on this small modification?

Thanks!

Last edited by ThinkBusiness; 05-03-2010 at 08:46 PM.
ThinkBusiness is offline   Reply With Quote
Old 05-04-2010, 07:50 AM   #8
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by ThinkBusiness
Thanks Larry!

Actually all I need is to display this menu and remove a couple of design elements in the showlistings template for any listing contained in the bars category.

I have added the debug command but I am not getting any pop up when viewing an entry.
If you only want to alter the menu on the showlistings page then that is the page you should be looking for a variable on. If the smarty debug console is not popping up its likely one of 2 things, you have the seo mod installed or your computer is blocking popups.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 05-05-2010, 06:20 AM   #9
Customer
 
Join Date: May 2010
Posts: 9
Rep Power: 0
ThinkBusiness is on a distinguished road
Default

Hi Larry! Yes you are right the SEO module is installed!
ThinkBusiness is offline   Reply With Quote
Old 05-07-2010, 10:47 AM   #10
Customer
 
Join Date: May 2010
Posts: 9
Rep Power: 0
ThinkBusiness is on a distinguished road
Default

Thanks Larry the missing value I needed was actually, $categoryname. Thanks for the pointers Mike you guys are stars!
ThinkBusiness is offline   Reply With Quote
Reply

Tags
categories , smarty

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Smarty Error freeze2 Technical Support 4 04-27-2010 11:45 PM
Smarty In CSS bowers01 Templates, HTML, CSS, and Design Help 3 06-01-2009 10:15 AM
Smarty help island1 Templates, HTML, CSS, and Design Help 2 01-09-2009 04:19 PM
Limit Smarty bowers01 Technical Support 2 01-02-2009 07:38 AM
I need a hand on smarty please... canariasdata Technical Support 32 06-14-2008 05:26 AM


All times are GMT -4. The time now is 07:12 AM.


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