Support Forums

Call Category Picture

This is a discussion on Call Category Picture within the Templates, HTML, CSS, and Design Help forums, part of the General category; Developer 4.1.10 Hello, I have a 2 Part Question. I am using the Promotional Category Text {$promo} and I need ...


Go Back   68 Classifieds Forums > General > Templates, HTML, CSS, and Design Help

Reply
 
Thread Tools Display Modes
Old 02-21-2011, 08:02 PM   #1
Scotty
 
Join Date: Apr 2010
Posts: 29
Rep Power: 6
pickyourownpet.com is on a distinguished road
Default Call Category Picture

Developer 4.1.10


Hello,

I have a 2 Part Question. I am using the Promotional Category Text {$promo} and I need a little help.

In the Browse.tpl, I am trying to place code to replace the {$promo} IF {$promo} is not null (I don't know the programming language). I have the proper CSS in place and I am really close. I need it to work like this:
Code:
{if isset($promo)}
	<div class="displayhead">
<div class="catpic">
<img src="{$data[td].image}" />
</div><div class="catdes">{$promo}
</div></div>
{/if}
Now I am looking for the image source to actually be to Category Image that the customer is in, and this is not working either. I hope this makes sense. Thanks you!

Click here to see what I mean and what I am looking for.

Thank you!!
pickyourownpet.com is offline   Reply With Quote
Old 02-22-2011, 11:38 AM   #2
curmudgeon
 
Join Date: Mar 2006
Posts: 5,408
Rep Power: 137
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

"isset" is a php function not a smarty function....


{if},{elseif},{else} | Smarty
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 02-22-2011, 03:05 PM   #3
Scotty
 
Join Date: Apr 2010
Posts: 29
Rep Power: 6
pickyourownpet.com is on a distinguished road
Default

Thank You Larry for making me do the research! I have this so far and it works perfect except I cannot call the category image to save my life. Any other assistance would be great!

Code:
	{if $promo != ''}
	<div class="displayhead">
<div class="catpic">
<img src="{$data[td].image}" />
</div><div class="catdes">{$promo}
</div></div>
{/if}

Thanks Again!
pickyourownpet.com is offline   Reply With Quote
Old 02-22-2011, 04:01 PM   #4
curmudgeon
 
Join Date: Mar 2006
Posts: 5,408
Rep Power: 137
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

In order for you to "get" the category image it has to be available as a smarty variable ON the page currently being viewed.

That being said, generally speaking it doesnt make any sense to have a variable defined on a page where it isnt being used. When viewing an ad or a list of ads in a category im guessing the category image isnt needed and thus isnt available.

use the debug console to show you the variables that are available on the page where you want to display the category image, what do you see?
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 02-22-2011, 04:27 PM   #5
Scotty
 
Join Date: Apr 2010
Posts: 29
Rep Power: 6
pickyourownpet.com is on a distinguished road
Default

I see a lot of nonsense- I understand (to a point) what is going on, though I don't necessarily understand what to pick from it and how to place it in the code I desire.

I found the following:

SELECT id,parent_id,name,slug,description,image,allowads, cLink,cKeywords,cPromo FROM class_categories WHERE slug='rottweiler' AND display<>'N'

I assume this particular line is describing the category that I am in. How would I pick and choose out of these available variables? I suppose I am looking for something like the id or parent_id and the image?
pickyourownpet.com is offline   Reply With Quote
Old 02-22-2011, 04:29 PM   #6
curmudgeon
 
Join Date: Mar 2006
Posts: 5,408
Rep Power: 137
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

in your code above you have....


<img src="{$data[td].image}" />


where did you come up with the smarty variable

{$data[td].image}
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 02-22-2011, 04:34 PM   #7
Scotty
 
Join Date: Apr 2010
Posts: 29
Rep Power: 6
pickyourownpet.com is on a distinguished road
Default

I randomly stole it from browse.tpl (knowing it would not necessarily work). It pulls the subcategory images, but I figured I could somehow work with it. if I use {$categoryid}, it will give me the id number.

{$categoryid.image} does not work...


I was reading this thread, but the poster did not post exactly how he created a category image variable in category.php. I think that is what I need.

Last edited by pickyourownpet.com; 02-22-2011 at 04:38 PM.
pickyourownpet.com is offline   Reply With Quote
Old 02-22-2011, 10:13 PM   #8
curmudgeon
 
Join Date: Mar 2006
Posts: 5,408
Rep Power: 137
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

You can waste an aweful lot of time randomly grabbing tidbits and hope to make them work but your best bet is to spend a little time to understand how smarty works because in the long run it will save you tons of time. Guessing your way through it more often than not makes a mess.

use smarty debug to display the variables for the page your on. ONLY those variables displayed via debug on any given page will be available for use on that page. There is no category image variable on the page where you view listings. That leaves you a couple options, write a plugin to query the database to get the image OR embed php code to query the database to get the image. A plugin would be cleaner.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 02-26-2011, 10:27 AM   #9
Scotty
 
Join Date: Apr 2010
Posts: 29
Rep Power: 6
pickyourownpet.com is on a distinguished road
Default

Thank you for the help Larry. I appreciate it!
pickyourownpet.com is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Align picture directly below another picture swgj19 Templates, HTML, CSS, and Design Help 1 10-17-2010 04:09 AM
Category picture ccs TemplateCodes 3 11-15-2009 08:31 PM
Category title under or above category picture ? mikeyc Customizations 4 09-10-2009 12:49 PM
Category picture redking Technical Support 2 04-27-2009 05:38 PM


All times are GMT -4. The time now is 03:42 AM.


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