×
Blue Eagle 5 v1.5.4 has been Released (13 Sep 2020)

The Kunena team has announce the arrival of Kunena template Blue Eagle 5 v1.5.4 which is now available for download. This version addresses most of the issues that were discovered in development.

× This is for users to help other users, to discuss topics that are related to forum administration in general or problems in running Joomla. This is not the place to ask for Joomla support. If you want assistance with Joomla please ask at forum.joomla.org

Question How to add color to a echo command with a variable?

More
10 years 2 months ago - 10 years 2 months ago #1 by iLucato
Hi folks, if I have a code like that
<?php echo $myvariable; ?>

How do I get to make this variable red, green, whatever? I tried to put $myvariable between the tag font color but it didn't work. Surelly I don't know how to connect them.

Any tip?

P.S. it will need to supress/overcome the css style.

Thanks in advance.

Kunena 2.0.4 | 2013-01-18 [ Pharmacopoeia ], J!1.5.25, rhuk_milkyway, CB 1.8.1, AUP 1.5.13, UddeIM 2.5 and Akeeba Backup 3.3.9

EsferaDoBem.com.br | iLucato.com.br | BemDoado.com.br
Last edit: 10 years 2 months ago by iLucato.

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #2 by Cerberus
another one i can help you with :)
<?php echo "<font color=\"#COLORCODE\"> $myvariable; </font>"; ?>

change COLORCODE to the css color code you wish

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #3 by iLucato

Cerberus wrote: another one i can help you with :)

<?php echo "<font color=\"#COLORCODE\"> $myvariable; </font>"; ?>

change COLORCODE to the css color code you wish


Hmmm, almost there. There is some error. It shows a semicolon and just the semicolon gets the color and the variable doesn't. I tried to remove the 1st semicolon, but the css style seems to override this command.

Any other comment?

Kunena 2.0.4 | 2013-01-18 [ Pharmacopoeia ], J!1.5.25, rhuk_milkyway, CB 1.8.1, AUP 1.5.13, UddeIM 2.5 and Akeeba Backup 3.3.9

EsferaDoBem.com.br | iLucato.com.br | BemDoado.com.br

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #4 by Cerberus

iLucato wrote:

Cerberus wrote: another one i can help you with :)

<?php echo "<font color=\"#COLORCODE\"> $myvariable </font>"; ?>

change COLORCODE to the css color code you wish


Hmmm, almost there. There is some error. It shows a semicolon and just the semicolon gets the color and the variable doesn't. I tried to remove the 1st semicolon, but the css style seems to override this command.

Any other comment?


yer sry missed that semi colon, try now
<?php echo "<font color=\"#COLORCODE\"> $myvariable </font>"; ?>

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #5 by iLucato
Yup, as I said before...

I tried to remove the 1st semicolon, but the css style seems to override this command.


So, in sum, didn't work buddy. I was trying to make that moved "register" link you helped me in other thread to be in another color different from the CSS a:link for the all rest.

Kunena 2.0.4 | 2013-01-18 [ Pharmacopoeia ], J!1.5.25, rhuk_milkyway, CB 1.8.1, AUP 1.5.13, UddeIM 2.5 and Akeeba Backup 3.3.9

EsferaDoBem.com.br | iLucato.com.br | BemDoado.com.br

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #6 by sozzled
Try this instead:
<?php echo '<font color="#COLORCODE">' . $myvariable . '</font>'; ?>
Mind you, I really hate the use of the <font> tag. Much better to create a <div> or <span> and use CSS to change the colour.

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #7 by iLucato

sozzled wrote: Try this instead:

<?php echo '<font color="#COLORCODE">' . $myvariable . '</font>'; ?>
Mind you, I really hate the use of the <font> tag. Much better to create a <div> or <span> and use CSS to change the colour.


Hey Sozzled, good morning. Thanks for your try too, but it didn't work too. I don't have knowledge about PHP stuffs I move into programming by trial, error, hit and guessing. Well, actually it is among a span tag, but as I don't know how these stuff works I'm not sure if the variable in question would call another style that is overriding this command we put the variable into. As I said, I was trying to change the register link color to be different from all others where the code is:
<span class="">
<?php echo $registration; ?>
</span>

Anyway, thanks for your help.

Kunena 2.0.4 | 2013-01-18 [ Pharmacopoeia ], J!1.5.25, rhuk_milkyway, CB 1.8.1, AUP 1.5.13, UddeIM 2.5 and Akeeba Backup 3.3.9

EsferaDoBem.com.br | iLucato.com.br | BemDoado.com.br

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #8 by iLucato
I tried also to create a stile at the css kunena.forum-min.css file and didn't work. Here is what I did:

At the end of the all styles I added:
#Kunena span.kregisterlink{font-weigh:bold;color:#ff0000;}

and at the PHP code I added in the class the kregisterlink, so it looked like that:
<span class="kregisterlink">
<?php echo $registration; ?>
</span>

No success too.

Kunena 2.0.4 | 2013-01-18 [ Pharmacopoeia ], J!1.5.25, rhuk_milkyway, CB 1.8.1, AUP 1.5.13, UddeIM 2.5 and Akeeba Backup 3.3.9

EsferaDoBem.com.br | iLucato.com.br | BemDoado.com.br

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #9 by @quila
Hi iLucato,

if I understand right you want to change color ONLY for Register link in profilebox.

If that is right you need to do some step, becouse all links are probably already defined in your joomla template and also in kunena.
You can do it in this way:

1. you need to add new class for only that link.
Open the file login.php in /loginbox/ dir. Find that code
<span class="kprofilebox-link">
							<?php echo $registration ?>
						</span>
and replace with this code
<span class="kprofilebox-link k-reg">
							<?php echo $registration ?>
						</span>

as you can see I have added new class "k-reg" only for that link

2. you need to add color for that link in kunena css file
2.1 - open the file kunena.forum.css and add that rule at the end of file
#Kunena div.klink-block span.k-reg a {
	color: #FF0000; !important;
}
3. you need to compress css file
now, if you just put file kunena.forum.css on server will not work becouse kunena use compressed file kunena.forum-min.css if not in debug mode.
3.1 - Go here refresh-sf.com/yui/ and compress kunena.forum.css file, you will have kunena.forum-min.css
3.2 - Now you can put file kunena.forum-min.css on your server and overwrite existing file

That's all.

P.S. If you want to make some change to kunena template, to avoid to do all this step for every change, in the configuration of Kunena set Enable Debug Mode option to "Yes", then you can make all changes you want to kunena.forum.css and kunena will load that file.
One time you have finished to personnalise your template, compress that file like I have described above and turn Enable Debug Mode option to "No".

Hope this helps
Best Regards
The following user(s) said Thank You: rich

Please Log in or Create an account to join the conversation.

More
10 years 1 month ago - 10 years 1 month ago #10 by iLucato
Hi @quila.

Ops, I'm sorry for my delay on this one.

Very interesting tip. Thanks a lot. I didn't know this debug feature.

Just one question. As I didn't know it, I have made some changes directly in the compressed file (kunena.forum-min.css). So I think my uncompressed is different now.

Is there a way to do the inverse way?

I mean, decompress to make my "kunena.forum-min.css" become a "kunena.forum.css", so when turning on the debug mode I can have the latest changes I have made. Now a days if I turn it on, I'm not getting my latest lay-out. I think it is due I have changed into "-min" instead. :0)

Kunena 2.0.4 | 2013-01-18 [ Pharmacopoeia ], J!1.5.25, rhuk_milkyway, CB 1.8.1, AUP 1.5.13, UddeIM 2.5 and Akeeba Backup 3.3.9

EsferaDoBem.com.br | iLucato.com.br | BemDoado.com.br
Last edit: 10 years 1 month ago by iLucato.

Please Log in or Create an account to join the conversation.

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Time to create page: 0.166 seconds