Hello guys, I'm using CuteNews on my website and i create a custom template for my CuteNews, my question was like If there's a way to change the color of the titles Here is the code of how the title appear in the news:
[code]
<td><div><img src="http://www.famfamfam.com/lab/icons/silk/icons/page_word.png"><font color="grey"> {title}</font></div></td>[/code]
What im trying to do is something like
[IMG]http://gyazo.com/034347844f5829662b2c4d00a49e4c6e.png[/IMG]
Well if {category-id} == 1 ( i don't know how to make it or write it xD ) then
<td><div><img src="http://www.famfamfam.com/lab/icons/silk/icons/page_word.png"><font color="red"> {title}</font></div></td>
else
<td><div><img src="http://www.famfamfam.com/lab/icons/silk/icons/page_word.png"><font color="grey"> {title}</font></div></td>
end
Im wondering if there's a way to make this (: Thanks ! <3
[QUOTE=Luna Prey;43198831]Hope this helps~[/QUOTE]
No, this way is much easier and cleaner.
Depending on if your var is $categoryID or not, i'm unsure.
[CODE]
if($categoryid == 1){
?>
<td><div><img src="http://www.famfamfam.com/lab/icons/silk/icons/page_word.png"><font color="red"><? echo $title ?></font></div></td>
<?
}elseif($categoryid == 2){
?>
<div><img src="http://www.famfamfam.com/lab/icons/silk/icons/page_word.png"><font color="grey"><? echo $title ?></font></div></td>
<?
}else{
echo "Error";
}
[/CODE]
You see how nicer that is?
Wow thanks for the replies guys , and really forgive me about my weird spelling i'll try ! and edit back.
I add the
[code]
<?php if($categoryid == 1): ?>
<td><img src="http://www.famfamfam.com/lab/icons/silk/icons/page_word.png"/><span style="color:red"><?php echo $title ?></span></td>
<?php elseif($categoryid == 2): ?>
<td><img src="http://www.famfamfam.com/lab/icons/silk/icons/page_word.png"/><span style="color:grey"><?php echo $title ?></span></td>
<?php else: ?>
Error
<?php endif; ?>
[/code]
and when i test it the news looks like this:
[HR][/HR]
[IMG]http://gyazo.com/d56c9402e830ac66283918ccdbc41aed.png[/IMG]
They normally look like this:
[IMG]http://gyazo.com/24645bbb04385313c26d9259b665cd29.png[/IMG]
[HR][/HR]
BTW Doesn't affect the way you guys call it categoryid since the way of show-up is {category-id} ?
After testing the code i go back to the code and the <?php if($categoryid == 1): ?> become [B]<?php if(== 1): ?>[/B]
[editline]16th December 2013[/editline]
[QUOTE=Haskell;43198845]No, this way is much easier and cleaner.
Depending on if your var is $categoryID or not, i'm unsure.
[CODE]
if($categoryid == 1){
?>
<td><div><img src="http://www.famfamfam.com/lab/icons/silk/icons/page_word.png"><font color="red"><? echo $title ?></font></div></td>
<?
}elseif($categoryid == 2){
?>
<div><img src="http://www.famfamfam.com/lab/icons/silk/icons/page_word.png"><font color="grey"><? echo $title ?></font></div></td>
<?
}else{
echo "Error";
}
[/CODE]
You see how nicer that is?[/QUOTE]
The way the categories are being called in the code is: {category-id}, so instead of showing up that text appear the ID of the category in the text. :) ( BTW with this code keep replacing the $categoryid == 2 for only == 2 x_x
[B]IMPORTANT LINK: [url]http://gyazo.com/c03e1016c4391740127e412f41f349af.png[/url][/B]
if you can't find the PHP variable {category-id} is coming from, then you have to use javascript.
it would be something like
[php]<script>
var categoryid = "{category-id}";
</script>[/php]
and make an if statement based on that;
Sorry, you need to Log In to post a reply to this thread.