Support Forums

Old 06-07-2007, 07:29 AM   #1
Member
 
Join Date: Dec 2006
Posts: 96
Rep Power: 13
objelland is on a distinguished road
Default Viewlisting.tpl.php

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
objelland is offline   Reply With Quote
Old 06-07-2007, 09:49 AM   #2
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,249
Rep Power: 122
Eric Barnes is a jewel in the rough
Default

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
Eric Barnes is offline   Reply With Quote
Old 06-07-2007, 09:51 AM   #3
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 2,224
Rep Power: 62
juven14 is a jewel in the rough
Default

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:
$category 0;
if (
$_GET['sec'] <> '' || isset($_GET['sec']) {
     
$category = (int)$_GET['sec'];
} else {
     
$category = (int)$_GET['type'];
}

switch (
$category)   //.... 
opps, my bad, the above would be something you'd use in category.php not viewlisting.php Eric has it right.
__________________
John Snyder
PHP Developer
juven14 is offline   Reply With Quote
Old 06-07-2007, 10:06 AM   #4
Member
 
Join Date: Dec 2006
Posts: 96
Rep Power: 13
objelland is on a distinguished road
Default Thanks guys

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
objelland is offline   Reply With Quote
Old 06-07-2007, 05:49 PM   #5
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,693
Rep Power: 48
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

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
Mike-N-Tosh is offline   Reply With Quote
Old 06-08-2007, 05:16 AM   #6
Member
 
Join Date: Dec 2006
Posts: 96
Rep Power: 13
objelland is on a distinguished road
Default Viewlisting.php

Hei Mike

Yes, of course, you are right. Just a typo in the thread
Thakns for noticing

Oyvind
objelland is offline   Reply With Quote
Old 08-03-2007, 02:01 PM   #7
Senior Member
 
CHRD's Avatar
 
Join Date: Nov 2006
Posts: 190
Rep Power: 15
CHRD is on a distinguished road
Default

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.
CHRD is offline   Reply With Quote
Old 08-07-2007, 05:14 PM   #8
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,693
Rep Power: 48
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

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.
Mike-N-Tosh is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


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


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