How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Location of the Videos
Post Reply
User avatar
RafliArema
Posts: 25
Joined: Tue Jul 12, 2011 11:14 am

How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Post by RafliArema »

How to formatting text inside the php tags?

EXAMPLE:

Code: Select all

<?php
include_once 'connect.php';
?>
<?php
$bypass = 0;
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
$playergold = $playerinfo3['gold'];
$playerlevel = $playerinfo3['level'];
$playerexp = $playerinfo3['exper'];
$playername = $playerinfo3['name'];
$playertribes = $playerinfo3['tribes'];
$playerlocation = $playerinfo3['location'];
?>


<link rel="stylesheet" href="gpack/inside.css" type="text/css" />
<div class="Standard">
              <ul class="Standard">
            <li class="Standard">Username: <?php print $playername; ?></li>
            <li>Level: <?php print $playerlevel; ?></li>
            <li>Pengalaman: <?php print $playerexp; ?></li>
            <li>Suku: <?php print $playertribes; ?></li>
            <li>Lokasi: <?php print $playerlocation; ?></li>
            <li>Jumlah Emas: <?php print $playergold; ?></li>
            </ul>
            </div>
The Output of the code above is just a plain text.... No format...
My question, is how to formatting the text inside the <?php print $variables ?> ??
Format the $variables, like font colors, size, etc


Thank you for help me out....
I will put [SOLVED] on the title if this problems solved :)
User avatar
62896dude
Posts: 516
Joined: Thu Jan 20, 2011 2:39 am

Re: How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Post by 62896dude »

Assuming that you are familiar with div tags, all you have to do to use a div tag in PHP is use:

Code: Select all

echo "<div id='div_name_here_from_style.css'>";
echo "blah blah blah text text content blah";
echo "</div>";
That's all it takes, you just have to make sure that when you are using a div id, the id that you reference must already be in your style.css, and that is where you format that id
Languages: C++, C#, Javascript + Angular, PHP
Programs: Webstorm 2017, Notepad++, Photoshop
Current Project: HP Destiny
User avatar
RafliArema
Posts: 25
Joined: Tue Jul 12, 2011 11:14 am

Re: How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Post by RafliArema »

Thank you for try to help me out,
But it's 100% not working...

What do you mean with div id?
Do you mean file name.css?




Rafli
[STILL UNSOLVED]
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Post by Jackolantern »

Do you know how to use CSS? That is how all text should be formatted. You can either wrap an entire block in a div like:

Code: Select all

<div id="myDiv">This is a text block. Most browsers will put space above and below it.</div>
Or you can use a span tag, which is commonly used for adding formatting to only a segment of a text block:

Code: Select all

<p>This is another text block. However, I <span id="mySpan">may</span> want to format only part of it.</p>
Then you can use those IDs to style your text anyway you want:

Code: Select all

#myDiv {
     text-align: right;
     color: blue;
}

#mySpan {
     font-style: italic;
}
The indelible lord of tl;dr
User avatar
62896dude
Posts: 516
Joined: Thu Jan 20, 2011 2:39 am

Re: How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Post by 62896dude »

good explanation Jack, that is what you should be doing Rafli
Languages: C++, C#, Javascript + Angular, PHP
Programs: Webstorm 2017, Notepad++, Photoshop
Current Project: HP Destiny
User avatar
RafliArema
Posts: 25
Joined: Tue Jul 12, 2011 11:14 am

Re: How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Post by RafliArema »

I already put

#UserStats {
color: blue; font-size:36px;
}

on style.css, but when Im
<?php echo "<div id='UserStats'>";
echo $playername;
echo "</div>";?>

It doesn't change....
The style is same like before....

I confused,
Please help me....
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Post by hallsofvallhalla »

or simplify it and add HTML

Code: Select all

echo "<font color='#FFFFFF'> Hello </font><b><u>World</u></b>";
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Post by Jackolantern »

Formatting HTML really shouldn't be used. It is deprecated, and browsers are free to remove support at any time. Of course, they likely won't, but that is the danger of using deprecated tags.
The indelible lord of tl;dr
User avatar
62896dude
Posts: 516
Joined: Thu Jan 20, 2011 2:39 am

Re: How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Post by 62896dude »

Do you have the link href tag or whatever its called in your code to reference style.css? If not, that is your problem
Languages: C++, C#, Javascript + Angular, PHP
Programs: Webstorm 2017, Notepad++, Photoshop
Current Project: HP Destiny
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: How to Formatting Text inside <?php ?> tags? [UNSOLVED]

Post by hallsofvallhalla »

They will support it forever most likely. Not sure why anyone would want to create a CSS div for everything that is bolded. Or even use the same one. Kinda silly. You can create a div to bold one word or put b tags around it. Standard HTML. Don't see how using HTML is considered bad and if it is then everyone has went way too far on the standards bandwagon.
Post Reply

Return to “Older Browser MMO Videos”