Jump to content

Recommended Posts

 

Hi.

 

In the code below I want to style the variable total and the word USD from a customized stylesheet.

I tried to make this work based on a previous answer, but i failed. 

I know now how to style a paragraph in HTML from CSS, but don't have a clue about how to style a variable.

 

Best regards Morris.

 

while($row = mysql_fetch_assoc($chart))

{echo $row['artist']."..."

.$row['city']." "

.$row['country']." "

.$row['total']." USD<br>";}

Link to comment
https://forums.phpfreaks.com/topic/248895-how-to-style-a-variable/
Share on other sites

well you can parse some HTML to wrap around the variable and style it.. in this case lets say a span.. like so..

 

echo "<span class='testCSS'>".$row['total']." USD</span>";

 

then style the span however you want the text to look like..

 

Edit: thorpe beat me to it..

Thanks!

 

I will have to insert this line within the while loop, so all the totals and USD in this list will be styled.

 

But where in my code do I insert this line??:  echo "<span class='testCSS'>".$row['total']." USD</span>";

 

With or without the echo word? Will you show me?

 

Thanks

 

I tried it now, thanks. It dosn't work ...

 

I have this code:

 

while($row = mysql_fetch_assoc($chart))

{echo

$row['artist']."..."

.$row['city']." "

.$row['country']." "

"<span style='bigHitList'>".$row['total']." USD</span>";

 

I placed the below code in the css file:

 

.bigHitList {

  font-size: 18px;

  color: yellow;

}

 

The browser writes:

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';'

 

What am I doing wrong?

 

 

OK.

Now this is working as a stand-alone-script on my server, together with a stand-alone-css file:

 

while($row = mysql_fetch_array($chart))

{echo

$row['artist']."..."

.$row['city']." "

.$row['country'].

" <span class='bigHitList'>".$row['total']." USD</span><br>";}

 

GREAT! - thank you so much!

 

Now I added this script to my Joomla 1.7 site, and here it shows right, but dosn't get styled.

 

Where exactly should I insert the CSS file in the Joomla style sheet?

Or where do I upload my own stylesheet?

 

(I've tried the edit.css and the template.css files in my template folder without luck)

 

 

Best regards Morris

as I have only used Joomla for a brief time, I really cannot remember.. however if you look at a view source of your page to see which css files are linked to that page, inserting the class styling in any one of those css files should work.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.