|
|
#1 |
|
Member
Join Date: Dec 2006
Posts: 96
Rep Power: 13 ![]() |
Hi
I am trying to use the following code in viewlisting.tpl.php, posted by John Snyder, to determine which layout template to use when presenting an ad in a certain category. According to threads in this forum this code should be valid for doing so. code: switch ( $section ) { case '2' : $class_tpl->assign( 'body', 'custom.tpl.php'); break; case '3' : $class_tpl->assign( 'body', 'othercustom.tpl.php'); break; default : $class_tpl->assign( 'body', 'viewlistings.tpl.php'); break; } The thing is that I can't get it to work. I am not sure if I set right value right for the case options. Here is my uri for the category: category.php?type=32&sec=41 Should I use the number 32 or 41? Neither works? Any feedback on this will be highly appreciated. Thank Oyvind |
|
|
|
|
|
#2 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,249
Rep Power: 122 ![]() |
Can you try this:
Code:
switch ( $listingsection )
{
case '41' :
$class_tpl->assign( 'body', 'custom.tpl.php');
break;
case '32' :
$class_tpl->assign( 'body', 'othercustom.tpl.php');
break;
default :
$class_tpl->assign( 'body', 'viewlistings.tpl.php');
break;
}
You would need to enter the number of the category id. You can find this in the administration category section.
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
#3 |
|
Moderator
|
Well 32 is the parent category and 41 is the child category. You could probably add something like this to get down to the last category:
PHP Code:
__________________
John Snyder PHP Developer |
|
|
|
|
|
#4 |
|
Member
Join Date: Dec 2006
Posts: 96
Rep Power: 13 ![]() |
Hey
Thank you for your replies. I don't have the time to check out your answers to my problem right now, but will do as soon as I have the chance. Thanks a lot for your help Oyvind
|
|
|
|
|
|
#5 |
|
68 Evangelist & Developer
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,693
Rep Power: 48 ![]() ![]() |
Actually, the code you are referring too does NOT go into the viewlisting.tpl.php file, it goes in viewlisting.php.
-Mike
__________________
Mike-N-Tosh IndianaPC.org - A community website (v3.1.10 Developer - heavily modified) Sandbox (v3.1.10, v4.0.9, 4.1.5) Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as 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 |
|
|
|
|
|
#6 |
|
Member
Join Date: Dec 2006
Posts: 96
Rep Power: 13 ![]() |
Hei Mike
Yes, of course, you are right. Just a typo in the thread Thakns for noticing Oyvind |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Nov 2006
Posts: 190
Rep Power: 15 ![]() |
Hi, dose this mod only work with CATs or will this mod let me fix a certain layout to a listing or do all listings use the same layout
Also will it work with the SEO upgrade what Im looking for is to fix a layout to a CAT then fix that layout to all the listings in that CAT Thanks Glenn
__________________
Costa del Sol Spain v3.1.10 Dev V4.09 Dev sweeeet �Powerful you have become, the dark side I sense in you.� Last edited by CHRD; 08-03-2007 at 02:41 PM. |
|
|
|
|
|
#8 |
|
68 Evangelist & Developer
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,693
Rep Power: 48 ![]() ![]() |
I'm not sure that I'm following you completely, however the way to look at how the code works is like this:
All listings use the default layout template (viewlistings.tpl.php or viewlistings2.tpl.php as defined in admin) If you use the code modification listed above, then it will use the custom.tpl.php instead. In the code modification, you need to use the lowest denominator (sec="THIS NUMBER") In laymens terms, if you have the following category structure: Cars (cat#=4) Honda (cat#=12) Ford (cat#=14)ATVs (cat#=28) If you want all the "Cars" ads to use the "Customcar.tpl.php" you need to include each of the subcategory numbers in your code (12 & 14). If you also allow ads to be posted in your main "Cars" category, then you would also need to include 4 in your code as well. To use "CustomATV.tpl.php" for your ATV listings, you just need to include the category number 28 in the code, because it does not have any subcategories. Hope that helps, Mike
__________________
Mike-N-Tosh IndianaPC.org - A community website (v3.1.10 Developer - heavily modified) Sandbox (v3.1.10, v4.0.9, 4.1.5) Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as 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 Last edited by Mike-N-Tosh; 08-07-2007 at 05:16 PM. |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Showlistings2.tpl.php help | CHRD | v3.1 Questions & Support | 34 | 11-13-2006 02:37 PM |
| viewlisting.tpl.php V3.0.15 DEV | newone | v3.0 Questions & Support | 3 | 07-02-2006 01:50 PM |