Support Forums

Old 04-08-2007, 03:09 AM   #1
Senior Member
 
midi510's Avatar
 
Join Date: Mar 2007
Location: Mammoth Lakes, Ca
Posts: 135
Rep Power: 13
midi510 is a jewel in the rough
Default Display link in only 2 cats

I'm new to php. Could someone please tell me why this doesn't work. Cat Id 17 & 18 are the two cats in autos (2wd & 4wd).

PHP Code:
{if $sec== "17" || $sec== "18"
  <
tr>&nbsp;</tr>  
  <
tr>       
   <
td colspan="2" align="center"><a href="http://www.kbb.com" target="_blank"><strong>Kelly Blue Book Link</strong></a></td>   
  </
tr>
 {/if} 
Also, is this a bad idea? Some advertisers might not want viewers to have such a link. I was thinking of giving advertisers the choice in checkout, but I'm not sure if I can set a link as an option in admin.

Thanks,
__________________
Kirk
V3.1.7 Developer
May you & your loved ones be blessed with
Grace, Peace, Forgiveness, Love, Wisdom, & Joy
midi510 is offline   Reply With Quote
Old 04-08-2007, 03:26 AM   #2
Senior Member
 
midi510's Avatar
 
Join Date: Mar 2007
Location: Mammoth Lakes, Ca
Posts: 135
Rep Power: 13
midi510 is a jewel in the rough
Default

I also added this to the last part of category.php

PHP Code:
$class_tpl->assign('sec'$sec); 
__________________
Kirk
V3.1.7 Developer
May you & your loved ones be blessed with
Grace, Peace, Forgiveness, Love, Wisdom, & Joy
midi510 is offline   Reply With Quote
Old 04-08-2007, 08:25 AM   #3
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,567
Rep Power: 45
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

Kirk,

I don't know php either, but I have done a lot of modding to my site (Thanks to much help from others in this forum) that is specific to different categories/subcategories.

Calls that are made specifically to the category ids will only work within specific files (mainly the non-template files. eg: viewlisting.php vs viewlisting.tpl.php) The template files are usually sent data within an array that don't correlate to what's in the database.

So the first question that the php gurus on here are going to need to be able to help is, what file are you inserting this php code into?

-Mike
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.3)
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 04-08-2007, 11:19 PM   #4
Senior Member
 
midi510's Avatar
 
Join Date: Mar 2007
Location: Mammoth Lakes, Ca
Posts: 135
Rep Power: 13
midi510 is a jewel in the rough
Default

Yes, that would be a useful bit of information, wouldn't it. Viewlistings.tpl.php. The idea is that if the ad is for a auto the link shows up.

I'm under the impression that since the tpl files are php pages, they are parsed like any other php file. The large amount of html they contain is just ignored by the "php engine?" and appeals to the browser which ignores the php code.

I'm thinking that I may have to tell category.php to look at viewlistings.tpl.php for the if statement.
__________________
Kirk
V3.1.7 Developer
May you & your loved ones be blessed with
Grace, Peace, Forgiveness, Love, Wisdom, & Joy
midi510 is offline   Reply With Quote
Old 04-08-2007, 11:59 PM   #5
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 2,206
Rep Power: 61
juven14 is a jewel in the rough
Default

I'm not sure I get what you are wanting to do, I'll have to read again. However, I will explain how the template system works.

While they are php files they are not processed like regular php files. What happens is you assign variables via smarty assign in the core file like category.php. Then when the page is called smarty complies the code from the core file with the template control structures and variables, then it is rendered into html for the browser. For a better understanding open one of the compiled template files located in templates_c folder.
__________________
John Snyder
PHP Developer
juven14 is offline   Reply With Quote
Old 04-09-2007, 12:07 AM   #6
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,567
Rep Power: 45
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

Kirk,

Yes, the template file is a php file and it is parsed, however at the point that you reach the template file the information is being passed in arrays. You can verify that by placing {debug} in the layout.tpl.php file and then going to the appropriate page. I had this exact same issue myself.

I believe that you would need to do what I did, which is to actually create a different viewlisting.tpl.php file for the category(s) that you are wanting the different information displayed in.

I am using a custom viewlisting template pages for my categories, announcements, all subcategories in Real Estate and all subcategories in Vehicles. The key is in the viewlisting.php file (Where it is still retrieving directly from the DB instead of a "smarty" array).

In the viewlisting.php file is where the calls to the DB are for the actual category id. If you go to this thread that I started a while back, you can see the logic and the final solution.

Different template for categories?

I hope this helps and if you need more specific information as to how I resolved this after understanding let me know. (You can follow the link to my site and see a live listing in the Real Estate >> For Rent to see the new opportunities that this opens)

-Mike
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.3)
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 04-09-2007, 10:43 AM   #7
Senior Member
 
midi510's Avatar
 
Join Date: Mar 2007
Location: Mammoth Lakes, Ca
Posts: 135
Rep Power: 13
midi510 is a jewel in the rough
Default

I don't have time to read that thread now, gotta go to work, but I will tonight.

I was hoping to avoid separate viewlisting tpls, but that will probably give me what I want. Which seems to be what you did. Do I have to have a separate viewlisting.php for each viewlisting.tpl.php?

I tried to place this link (original post) as an option in an extra field in admin, but it didn't work out. If you've (Mike) had success with separate viewlisting tpls, I'll probably have some more questions for you.

I was hoping that V4 would have a drop down for all fields (not just extras) to assign to cats.

Thanks,
__________________
Kirk
V3.1.7 Developer
May you & your loved ones be blessed with
Grace, Peace, Forgiveness, Love, Wisdom, & Joy
midi510 is offline   Reply With Quote
Old 04-09-2007, 03:44 PM   #8
Senior Member
 
midi510's Avatar
 
Join Date: Mar 2007
Location: Mammoth Lakes, Ca
Posts: 135
Rep Power: 13
midi510 is a jewel in the rough
Default

Mike,

Do you also have custom usercheckout templates? I would think for step 3 you would have custom tpls to fill the custom fields. I looked at an apartment rental ad on your site and it's what I'm looking to do, just not as much info. I'm surprised there aren't more people wanting to do that.

Thanks,
__________________
Kirk
V3.1.7 Developer
May you & your loved ones be blessed with
Grace, Peace, Forgiveness, Love, Wisdom, & Joy
midi510 is offline   Reply With Quote
Old 04-09-2007, 05:20 PM   #9
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,567
Rep Power: 45
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

Quote:
Originally Posted by midi510 View Post
Do you also have custom usercheckout templates? I would think for step 3 you would have custom tpls to fill the custom fields.
No, I don't but I would like to. I started a thread on that specifically too, but no one ever responded. I ran out of time to include that in my Phase 1 rollout to go public with the site.

Quote:
Originally Posted by midi510 View Post
I looked at an apartment rental ad on your site and it's what I'm looking to do, just not as much info. I'm surprised there aren't more people wanting to do that.
I think that there are lots of folks who actually want to or have done that just by the simple number of views that the thread has.

You only need to modify the original viewlisting.php file and then within that modification code include a separate line for each category ID that you want a separate viewlisting.tpl.php file for.

-Mike
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.3)
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

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
How to display category total listings? dankellaway v3.1 Questions & Support 2 03-13-2007 01:25 PM
Only display main cats in category drop down? wiredhat v3.1 Questions & Support 10 02-07-2007 02:59 PM
Yahoo Maps - I can not get it to display link redmtnex v3.1 Modules & Modifications 15 01-23-2007 11:09 PM
ad is about to expire link garysmith v3.1 Questions & Support 3 06-14-2006 06:27 PM
How to Easily Find Link to "My Store" hppenterprises v3.1 Questions & Support 6 06-02-2006 10:23 AM


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


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