I want a topic's title red...Only one topic's...And also wanna make it bold....
Any way to do this ?
_________________________________________
Solution :
Sources/MessageIndex.php :
// 'Print' the topic info.
and above it, add
$color = $row['ID_TOPIC'] == '6395' ? 'red' : '';
$weight = $row['ID_TOPIC'] == '6395' ? 'font-weight: bold;' : '';
*6395 is the topic ID,changeable....
___________
Then down below
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['firstSubject'] . '</a>'
change it to to...
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" style="color: '. $color. '; '. $weight .'">' . $row['firstSubject'] . '</a>'
Credits : Kender , JohnyB
If you mark it as a sticky topic, you can change the CSS for .windowbg_sticky to show it red. Otherwise, I don't think there's a way to do it.
It's quite possible. Make it so that only admins can use BBcode or HTML in their post titles.
@Spaceman-Spiff ; it's true but,i just want to change one topic's color...
@ccbtimewiz ; i didn't understand what you said,pls can u explain it?
ccbtimewiz, that will cause bbc and html characters in the page title, which won't render properly.
There's a way to make all topics color red. :)
Quote from: Eliana Tamerin on March 28, 2008, 05:53:53 PM
ccbtimewiz, that will cause bbc and html characters in the page title, which won't render properly.
Simply strip HTML tags in the page title.
strip_tags($context['page_title'])
Allowing HTML tags opens up security and layout destruction possibilities. BBC would be much safer, though I'm not sure there's a strip BBC function.
...
You would obviously use BBcode in the title. Then when it converts into the title, it would obviously be HTML seeing how BBcode transgorates into HTML. At that point, you would strip the HTML.
There's no difference.
Back to the topic. :P
The MessageIndex.template.php refers to the topic link so you can't change the color from there. You have to change the color in the Source file. And if you are willing to edit your MessageIndex.php, here's my solution.
// 'Print' the topic info.
and above it, add
$color = $row['ID_TOPIC'] == '122' ? 'red' : '';
The number '122' is the topic id number. Change it with your topic id and change the color.
Then down below
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['firstSubject'] . '</a>'
and replace with
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" style="color: '. $color. ';">' . $row['firstSubject'] . '</a>'
@JohnyB ;
thx,i think it's the solution,but i could't find "// 'Print' the topic info." in MessageIndex.template.php, i use a different theme,couldn't find it even in the default theme... :S
Also the other codes started with "'link' => '<a href="'......."
?
Sorry if my message confused you but if you will read it again, you'll find out that I was talking about Sources/MessageIndex.php and not the template. The file you have to edit is Sources/MessageIndex.php and you can find it in the Sources folder.
OMG Thx so much JohnyB , it really works...Thx...
Sorry but a little que, can i make that topic also "bold" ?
style="color: '. $color. '; font-weight: bold;">
just a snip of what you have already changed with the edit to make it bold
Ops, all the topics became bold with both of yours way..... :o
If you don't like Kender's way, then we have to change our codes.
Replace the
$color = $row['ID_TOPIC'] == '122' ? 'red' : '';
with
if ($row['ID_TOPIC'] == '122')
$link = '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" style="color: red; font-weight: bold;">' . $row['firstSubject'] . '</a>';
else
$link = '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['firstSubject'] . '</a>';
and the
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" style="color: '. $color. ';">' . $row['firstSubject'] . '</a>'
with
'link' => $link,
$weight = $row['ID_TOPIC'] == '122' ? 'font-weight: bold;' : '';
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" style="color: '. $color. '; '. $weight .'">' . $row['firstSubject'] . '</a>'
Kender thx but what should i put between the color and bold codes ?
$color = $row['ID_TOPIC'] == '6395' ? 'red' : '' ? 'font-weight: bold;' : '';
reread my message
you would put my first line of text above or below the $color =
then you would modify the link text to read what i wrote in my second line
$color = $row['ID_TOPIC'] == '6395' ? 'red' : '';
$weight = $row['ID_TOPIC'] == '6395' ? 'font-weight: bold;' : '';
then change the link to...
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" style="color: '. $color. '; '. $weight .'">' . $row['firstSubject'] . '</a>'
Sorry, I was editing my message when you replied. You now have choice. :D
Kender & JohnyB , thx so much...
Sorry i'm a nooby :D But i manage at last :p
Thx again,i think it comes in handy for everyone.....
thats what a "community" does, is help eachother
Thanks Kender. Help is very much appreciated.
I add the solution in my first post for everyone... ;)
Changed the icon so :=)
You forgot to edit the message icon. Change it to "solved". ;)
I was just thinking about this, not that you need to do so, but more information.
If you chose JohnyB's solution and want to include more topics, you can always change the line
if ($row['ID_TOPIC'] == '122')
to
if ($row['ID_TOPIC'] == '122' || $row['ID_TOPIC'] == 'xxx')
replacing xxx with any topic ID you want. Add additional topics by just expanding the code by one more || $row['ID_TOPIC'] == 'xxx' line.
Not sure if that would work for Kendar's solution, but it might if you did this:
$color = $row['ID_TOPIC'] == '6395' ? 'red' : '';
$weight = $row['ID_TOPIC'] == '6395' ? 'font-weight: bold;' : '';
to
$color = $row['ID_TOPIC'] == '6395' || $row['ID_TOPIC'] == 'xxx' ? 'red' : '';
$weight = $row['ID_TOPIC'] == '6395' || $row['ID_TOPIC'] == 'xxx' ? 'font-weight: bold;' : '';
How can i find out ID_TOPIC?
TNX.
Quote from: Don Pepito on April 07, 2008, 05:59:02 AM
How can i find out ID_TOPIC?
TNX.
Do you mean the id number of a topic? Hover your mouse over the topic title and the id number will show up in your browser's progress bar. It's in the bottom of your browser, something like this.
http://..../.../index.php?topic=116.0
The 116 is the topic id.
Tanks a lot...