Support Forums

altering class="featured"

This is a discussion on altering class="featured" within the Templates, HTML, CSS, and Design Help forums, part of the General category; Hi Guys, I have a quick, and hopefully easy question for you. When a listing is a featured listing the ...


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

Reply
 
Thread Tools Display Modes
Old 09-06-2010, 07:10 AM   #1
Customer
 
Join Date: Aug 2010
Posts: 100
Rep Power: 7
T0m1 is on a distinguished road
Default altering class="featured"

Hi Guys,

I have a quick, and hopefully easy question for you.

When a listing is a featured listing the output (when you view all ads in a category as a list, think its showlistings.tpl) is so that the cells have a class attribute of featured.

So we have the following;
HTML Code:
<tr class="corAlg">
	     	     <td class="featured "><a title="My Girl Video" href="viewlisting.php?view=19"><img border="0" alt="My Girl Video" src="templates/royal/images/no_image.png"></a></td>
	                       <td class="featured "><a title="My Girl Video" href="viewlisting.php?view=19">My Girl Video</a></td>
                           <td class="featured ">$0.50</td>
         	     	     <td class="featured ">August 23, 2010</td>
	     	     	     	     <td class="featured ">demoville</td>
	     	     	     	     <td class="featured ">
	     	<a title="My Girl Video" href="viewlisting.php?view=19">View Listing</a>	     	
	     </td>
	</tr>
Each td has class="featured" . Where is it stipulated that the cell is to have a class of featured ?

Id love to be able to edit this so that I can have a corner badge show "Featured", but would have to change from a table to div's. But first things first, where is the call to say that td will have a class of featured.

Im guessing I could change the code in the tpl from this
PHP Code:
<td{if $entry.class<>""} class="{$entry.class}"{/if}> 
and place it in with the tr like so

PHP Code:
<tr class="corAlg {if $entry.class<>""}{$entry.class}{/if}"
But what do you guys think ?

Many thanks,
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes
T0m1 is offline   Reply With Quote
Old 09-06-2010, 10:25 AM   #2
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,342
Rep Power: 84
seymourjames is a jewel in the rough
Default

Classes are defined in your css style sheet. The specific class you mentioned is used in showlistings.tpl
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting

Last edited by seymourjames; 09-06-2010 at 10:32 AM.
seymourjames is offline   Reply With Quote
Old 09-07-2010, 09:12 AM   #3
Customer
 
Join Date: Aug 2010
Posts: 100
Rep Power: 7
T0m1 is on a distinguished road
Default

Hi David,

Thanks for your response

I am aware however where you write the class style. My question above had nothing to do with this? Actually .featured can stay in the css file, as im more concerned with where in the code is i dictated that the class to be called will be featured and not unfeatured a an example.

Many thanks,
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes
T0m1 is offline   Reply With Quote
Old 09-07-2010, 09:44 AM   #4
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,342
Rep Power: 84
seymourjames is a jewel in the rough
Default

Hold on - it is stipulated when the advert is created. Use debug in showlistings.tpl and you will see it is part of $results . However if all you want to do is change the background color or put in a background image which is what we do on our templates then you would change the css style sheet. I don't see why you would need to do the stuff you mention. If you only wanted to display a small image in one cell then you would simply apply a little bit of logic to the $results.

featured => "N" or featured => "Y" so you can test for it.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting

Last edited by seymourjames; 09-07-2010 at 09:47 AM.
seymourjames is offline   Reply With Quote
Old 09-07-2010, 11:30 AM   #5
Customer
 
Join Date: Aug 2010
Posts: 100
Rep Power: 7
T0m1 is on a distinguished road
Default

Hi David,

Im cautious of the fact that I would be leaving the logic as it should be but then redoing it ont he fly per featured ad? Id rather the change be permanent but incase I was confusing in my original post I will rephrase

*** BEGIN REPHRASE ***

I Intend to place an image next to featured items to make them more visible than the simple changing of a colour. I am fully aware that there is .featured in the css file and that I could simply add background-image: url(...); or a number of other variations into that particular class.

However, the class is being called a number of times which means the background image would be shown in each instance.

the showlistings.tpl has this block of code
PHP Code:
<td{if $entry.class<>""} class="{$entry.class}"{/if}>
</
td
by placing the {if} condition with $entry.class obviously it is saying out put class="{$entry.class}" if class = greater than or less than nothing.

currently {$entry.class} = featured (if the advert is a featured advert) or highlight etc (im assuming) if the advert is highlighted.

So my question is

Where is {$entry.class} defined? How does the call class="{$entry.class}" know it should be using "featured" as the class instead of say "featuring" or "feature"?

I want to invent a different class (lets say .featureTag so need to build this in).

I need to build this into the <tr> though and not the <td> as I only want it called once because you obviously have a <td> for each item shown such as date added, price, title, thumbnail.

*** END REPHRASE ***

So as you can see, my question is well beyond the scope of {debug} and also shows that im not after the CSS code either, but am more interested in where the class is defined in the php code.

Kindest regards, and thanks for answering
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes

Last edited by T0m1; 09-07-2010 at 11:33 AM.
T0m1 is offline   Reply With Quote
Old 09-07-2010, 12:01 PM   #6
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,342
Rep Power: 84
seymourjames is a jewel in the rough
Default

Everything is done on the fly in general. I don't think a little test is in anyway going to be detrimental or significant compared to the great amount of testing that goes on all over the script.

I don't think you are getting it. You test the variable which is set when an advert is placed (in the checkout process). I just told you what that variable was and where you find it in $results.

You simply test to see if the advert is featured in showlistings.tpl and if it is you place your image in the cell. I don't think it can be simpler. It is the nice thing about smarty. You can do these types of tests easily. An ad is either featured or it is not.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting

Last edited by seymourjames; 09-07-2010 at 12:03 PM.
seymourjames is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a "Product Directory" & "Find a Dealer" system spaceboy Technical Support 1 09-18-2008 06:16 PM
How to change title name "Place" to "post" on main page? YourPalAl Technical Support 4 04-28-2008 10:39 PM


All times are GMT -4. The time now is 09:53 AM.


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