|
|
#1 |
|
Junior Member
Join Date: Dec 2008
Posts: 5
Rep Power: 0 ![]() |
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. |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Mar 2008
Posts: 705
Rep Power: 19 ![]() |
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. |
|
|
|
|
|
#3 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,201
Rep Power: 36 ![]() ![]() |
__________________
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 |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Mar 2008
Posts: 705
Rep Power: 19 ![]() |
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. |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Dec 2008
Posts: 5
Rep Power: 0 ![]() |
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 |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,201
Rep Power: 36 ![]() ![]() |
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 |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Dec 2008
Posts: 5
Rep Power: 0 ![]() |
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. |
|
|
|
|
|
#8 | |
|
Senior Member
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 638
Rep Power: 16 ![]() |
Quote:
Cheers, Nick
__________________
Nick Bowers 68c v4.09 Developer |
|
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Dec 2008
Posts: 5
Rep Power: 0 ![]() |
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.
|
|
|
|
|
|
#10 |
|
Moderator
Join Date: Mar 2008
Posts: 705
Rep Power: 19 ![]() |
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. |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
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 |