Support Forums

Old 03-11-2009, 12:52 AM   #1
Junior Member
 
Join Date: Dec 2008
Posts: 5
Rep Power: 0
rubpay73 is on a distinguished road
Default custom viewlisting.tpl

Can anyone tell me how to call a custom viewlisting.tpl from the viewlisting.php. I want to have a different
viewlisting.tpl for one category.

68c v.4.1.0 Developer

Last edited by rubpay73; 03-11-2009 at 01:11 AM.
rubpay73 is offline   Reply With Quote
Old 03-11-2009, 08:21 AM   #2
Moderator
 
 
Join Date: Mar 2008
Posts: 705
Rep Power: 19
seymourjames has a spectacular aura about
Default

This is how I would do it but I am sure there are various ways. I would test for the $category variable in viewlisting.tpl . Something like

{if $category == " your cateogry name"}
do this
{else}
do something else
{/if}

I tested it and it works fine. I don't think it needs any core file changes.
__________________
TemplateCodes.com
seymourjames is offline   Reply With Quote
Old 03-11-2009, 08:52 AM   #3
Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,201
Rep Power: 36
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

or you could use the free custom category module released by 68 Classifieds.

Custom Category

-Mike
__________________
Mike-N-Tosh
v3.1.10 Developer IndianaPC.org - A community website
Sandbox v4.0.9, 4.1
Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds.
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 03-11-2009, 09:52 AM   #4
Moderator
 
 
Join Date: Mar 2008
Posts: 705
Rep Power: 19
seymourjames has a spectacular aura about
Default

I don't think that is is quite same thing Mike but I am open to correction - I have never used this module.

He wants a different viewlisting depending upon the category selected. In other words, even if it is search results, he is looking to display a different viewlisting dependent upon the category it sits in.
__________________
TemplateCodes.com
seymourjames is offline   Reply With Quote
Old 03-11-2009, 07:44 PM   #5
Junior Member
 
Join Date: Dec 2008
Posts: 5
Rep Power: 0
rubpay73 is on a distinguished road
Default

Yes Mike, James is right. I want a Custom Viewlisting.tpl not a Custom Showlisting.tpl for a Category. I've been trying something like this in the Viewlisting.php not viewlisting.tpl:

if($section=="83")
{
$class_tpl->assign('body','viewlistingcustom.tpl');
}
else
{
$class_tpl->assign('body','viewlisting.tpl');
}
...but it didn't work
any other suggestions?

68c v.4.1.0 Developer
rubpay73 is offline   Reply With Quote
Old 03-11-2009, 09:40 PM   #6
Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,201
Rep Power: 36
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

I did NOT say you wanted a showlisting.tpl, I never even mentioned showlisting in my post. The custom categories module does exactly this. It makes a custom viewlisting file for any category that you choose.

Whatever, do what you want to.

-Mike
__________________
Mike-N-Tosh
v3.1.10 Developer IndianaPC.org - A community website
Sandbox v4.0.9, 4.1
Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds.
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 03-11-2009, 10:07 PM   #7
Junior Member
 
Join Date: Dec 2008
Posts: 5
Rep Power: 0
rubpay73 is on a distinguished road
Default

Hey Mike, I think you're little confused. A custom catergory module makes a custom showlisting.tpl not a custom viewlisting.tpl. And no I'm not going to do what I want and all I'm asking is for Help. It seems to me you are having a bad day.

Last edited by rubpay73; 03-11-2009 at 10:12 PM.
rubpay73 is offline   Reply With Quote
Old 03-11-2009, 11:09 PM   #8
Senior Member
 
bowers01's Avatar
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 638
Rep Power: 16
bowers01 is on a distinguished road
Default

Quote:
Originally Posted by seymourjames View Post
This is how I would do it but I am sure there are various ways. I would test for the $category variable in viewlisting.tpl . Something like

{if $category == " your cateogry name"}
do this
{else}
do something else
{/if}
Iv done it like that before and it worked, it might not be the cleanest but it did work.
Cheers,
Nick
__________________
Nick Bowers
68c v4.09 Developer
bowers01 is offline   Reply With Quote
Old 03-11-2009, 11:53 PM   #9
Junior Member
 
Join Date: Dec 2008
Posts: 5
Rep Power: 0
rubpay73 is on a distinguished road
Default

Thanks Nick for your reply. I couldn't make it work using the $category=="category name", but I got it working using this: $section=="id" although I counldn't have done it without you guys. You got me on the right track. Thanks Mike for your time and I really mean it. I'm here to learn from Everyone.
rubpay73 is offline   Reply With Quote
Old 03-12-2009, 02:01 AM   #10
Moderator
 
 
Join Date: Mar 2008
Posts: 705
Rep Power: 19
seymourjames has a spectacular aura about
Default

No problem - glad to help.

It works with $section=="id" as well. If you use the $category variable then make sure you have the correct string including spaces around it. For example, on my test it had a space either side of the category string.

{if $category == " monohull yachts "}

In 4.09 - You can see the exact from of the category variable by using {debug} . Place in your layout.tpl file just above the <body> tag. It will open a window for you showing all the available variables in that template file.

In 4.01 there is a debug tool in admin I believe which you can turn on and off.

Just checked and it works with the $categoryname variable as well. Your choice what you use.

note: I would tend not to do it by editing viewlisting.php and making a second template file as this core file is more likely to change with upgrades.
__________________
TemplateCodes.com
seymourjames 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
search in viewlisting? kama HTML, CSS, and Design Help 0 06-23-2008 12:02 AM
LightBox for viewlisting,tpl.php LittleRascal v3.1 Questions & Support 2 03-03-2008 12:56 AM
Viewlisting.tpl.php objelland v3.1 Modules & Modifications 7 08-07-2007 05:14 PM
viewlisting.php objelland v3.1 Modules & Modifications 2 06-08-2007 08:18 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 08:53 PM.


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