68 Classifieds Forums
Go Back   68 Classifieds Forums > v3.1.x Help & Support > v3.1 Modifications > Different template for categories?
v3.1 Modifications Questions on modifying 68 Classifieds. Please note these are not supported by 68 Classifieds, and may make future updates more difficult.

 
Thread Tools Display Modes
(#1)
Old
Mike-N-Tosh Mike-N-Tosh is offline
Member
Mike-N-Tosh will become famous soon enough
 
Posts: 39
Join Date: Jan 2007
Default Different template for categories? - 02-20-2007, 09:46 AM

I'm sure that this is possible, but instead of having to re-invent the wheel I thought that I'd throw this out there.

Has anyone made different templates for specific categories?

I have two top level categories that I have added a number of extra fields to (Vehicles and Real Estate). I hate the default look of having all of those extra categories just listed one after another in the view listing.

I would assume that there must be a way to tell 68 classifieds something like:

If listing type=10 (example ID)
vehicle.tpl.php
elseif listing type=14 (second example ID)
realestate.tpl.php
else viewlisting.tpl.php
endif

Obviously, I'm not a programmer

Also, in order to make the specific templates for those categories, how do I call the specific extra fields separately to include them on the page where I would like to have them placed. The standard viewlisting.tpl.php file simply makes one call with a for each statement for ALL the extra fields.

Thanks in advance for any help, suggestions, etc.

-Mike
IndianaPC.org


Mike-N-Tosh
v3.1.5 Developer
Reply With Quote
(#2)
Old
suzkaw suzkaw is offline
Help you, I will.
suzkaw has a spectacular aura about
 
Posts: 1,696
Join Date: Mar 2006
Location: Belmont, NC
Default 02-20-2007, 11:28 AM

Hi Mike,

I believe Juven14 created a module for this at one time but I am not sure if it still around. You may want to try and searching these forums for it. I believe it was built for v3.0.

Also we do get this question a lot and for v4 I will see if I can't figure out a way of doing this.


--
Thanks,
Eric Barnes
68 Classifieds
Documentation - Modifications - My Blog

Reply With Quote
(#3)
Old
BABBSELA BABBSELA is offline
Old Timer
BABBSELA is on a distinguished road
 
Posts: 57
Join Date: Oct 2006
Location: Denver, Colorado
Default 02-20-2007, 12:41 PM

This is something I would like to to, too. I'd like to have additional fields for automobile ads, so I'm guessing I need to add tables to the db, an alternate template so they can fill in those fields if they choose the auto category, and an alternate template for displaying all the fields in the ad.

BTW: I didn't find this topic in 3.0. I may have used the wrong search terms. I'll look again and post here if I find anything.


Thanks,
Barbara

v 3.1.5 Developer

Get great deals in Denver and across the web, at Garage Sale Show.com
Best deal for the February: Get a FREE MIT Education.
Reply With Quote
(#4)
Old
juven14 juven14 is offline
Moderator
juven14 has a spectacular aura about
 
Posts: 1,656
Join Date: Mar 2006
Location: NJ/NYC Area
Default 02-20-2007, 01:22 PM

I only made different templates for the store pages. The user could develop a template or the admin and the admin set it in the store table.

The way I would probably do it would be to set a field for the category like the category image, and then just have it determine the template from there.


Regards,

John
mods.auscity.com
v3.1.5 Developer

�By perseverance, study, and eternal desire, any man can become great.� George S. Patton
Reply With Quote
(#5)
Old
Mike-N-Tosh Mike-N-Tosh is offline
Member
Mike-N-Tosh will become famous soon enough
 
Posts: 39
Join Date: Jan 2007
Default 02-20-2007, 01:45 PM

Quote:
Originally Posted by BABBSELA View Post
This is something I would like to to, too. I'd like to have additional fields for automobile ads, so I'm guessing I need to add tables to the db, an alternate template so they can fill in those fields if they choose the auto category, and an alternate template for displaying all the fields in the ad.
Actually (rereading my original post), I made the mistake of saying that I hate the look of it listing all of the "catgories" one right after another.

What it should have said is, ...listing all of the "extra fields" one after another. Making the "extra fields" is easy and is already built in to 68classifieds. (Admin/extra fields and attach to categories).

What I'm trying to say is that when a user either browses or searches, they then get a list of ads (listings). If they click on the photo or the "more" link, then it shows the ad in the "viewlisting.tpl.php" template which shows it within the layout template.

I can modify the "viewlisting.tpl.php" template which I have already done, BUT the "extra fields" are simply one call to see if there are extra fields and if yes, then display those too, one right after another. Also any changes in the viewlistin.tpl.php file is universal for ALL categories.

What I'm saying is two fold. I want to have more than one viewlisting.tpl.php. In the viewlisting.php (where the link is going when the user is in browse or already searched), I want it to see if the category is one of the custom categories for which there is a separate template and if there is show the listing using that template instead of the default.

I'm sure that it would work, but my biggest issue to resolve is how to get the individual "extra fields" in the custom layouts.

-Mike


Mike-N-Tosh
v3.1.5 Developer
Reply With Quote
(#6)
Old
juven14 juven14 is offline
Moderator
juven14 has a spectacular aura about
 
Posts: 1,656
Join Date: Mar 2006
Location: NJ/NYC Area
Default 02-20-2007, 02:07 PM

All you need to do is in viewlisting.php determine the section and then put an if or switch around it to display the viewlistings body template. I don't have access right now to my files but it would be something like this:

PHP 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;
}
Now for the extra fields you can call them directly like:

{$extra.something} -- I can't remember exactly, but I've seen a thread lHotch made addressing this very issue.


Regards,

John
mods.auscity.com
v3.1.5 Developer

�By perseverance, study, and eternal desire, any man can become great.� George S. Patton
Reply With Quote
(#7)
Old
Mike-N-Tosh Mike-N-Tosh is offline
Member
Mike-N-Tosh will become famous soon enough
 
Posts: 39
Join Date: Jan 2007
Thumbs up 02-20-2007, 02:24 PM

John,

Thanks, that's exactly what I was looking for. I'll search for the extra field calls that you referred too.

-Mike
When there's a will...
There's upset relatives!!!


Mike-N-Tosh
v3.1.5 Developer
Reply With Quote
(#8)
Old
BABBSELA BABBSELA is offline
Old Timer
BABBSELA is on a distinguished road
 
Posts: 57
Join Date: Oct 2006
Location: Denver, Colorado
Default 02-20-2007, 02:28 PM

Adding extra fields in the administration panel adds them for all categories. Would the extra fields for the custom template need to be entered into the db manually?

Your answer will take care of displaying the custom template with the extra fields, but to give the user the option to enter text into extra fields specific to that custom template, won't we have to put in a switch in the checkout process - like maybe in step1.tpl.php? Or am I looking in the wrong place?


Thanks,
Barbara

v 3.1.5 Developer

Get great deals in Denver and across the web, at Garage Sale Show.com
Best deal for the February: Get a FREE MIT Education.
Reply With Quote
(#9)
Old
suzkaw suzkaw is offline
Help you, I will.
suzkaw has a spectacular aura about
 
Posts: 1,696
Join Date: Mar 2006
Location: Belmont, NC
Default 02-20-2007, 02:30 PM

Quote:
Adding extra fields in the administration panel adds them for all categories. Would the extra fields for the custom template need to be entered into the db manually?
No you can bind extra fields to specific categories. So autos can have different fields than dogs.


--
Thanks,
Eric Barnes
68 Classifieds
Documentation - Modifications - My Blog

Reply With Quote
(#10)
Old
BABBSELA BABBSELA is offline
Old Timer
BABBSELA is on a distinguished road
 
Posts: 57
Join Date: Oct 2006
Location: Denver, Colorado
Default 02-20-2007, 02:45 PM

Uh, okay. Duh. I should have looked at the extra fields before posting.

[head: meet desk]


Thanks,
Barbara

v 3.1.5 Developer

Get great deals in Denver and across the web, at Garage Sale Show.com
Best deal for the February: Get a FREE MIT Education.
Reply With Quote


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Template? FlyingBee Template Design Questions 4 12-08-2006 11:17 AM
Sukaw Horse-Green Template Syssh v3.1 Questions & Support 3 12-03-2006 01:47 PM
HTML Template brian-bear Template Design Questions 7 10-12-2006 06:21 AM
Smarty Templates and You. Posted BY Lhotch suzkaw Template Design Questions 4 08-11-2006 04:59 PM
Dreamweaver Template in 68classifieds sporthorsebreeder Template Design Questions 3 04-23-2006 11:34 AM



Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2007, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com