Home > Questions and Answers > General Questions

coding question (6)


08-05-2012 05:44 AM #1 browndog (Member)
coding question

How do I make the text in a php script follow the css style for the rest of the page? I have text that says "Looking for women in [city]". Where [city] is replaced by a php geoscript. But I can't figure out how to make the city name appear in the same font/color as the rest of the text.

Thanks


08-05-2012 10:08 AM #2 bluebox (Member)

Code:
<p style="font-family:Verdana;color:red;">Your text here [city]</p>
If this doesn't work please paste your code here.


08-05-2012 12:30 PM #3 hd2010 (Member)

css just render whatever output by php, don't get confused of these 2 wonderful languages.


08-05-2012 03:18 PM #4 dubbsy (Member)

if you just want the city to be a different color, place the php tags inside a span tag, then style the span tag with css. Example:


<p>Find women in <span class="citytext">ENTER YOUR PHP/JAVASCRIPT HERE</span></p>

then the css for it however you want it to be styled:

<style>

.citytext {

color: red;
whatever else you want it to look like

}

</style>


That should work.


08-05-2012 07:42 PM #5 browndog (Member)

I've played around with this code for a while and can't get it to work. I'm brand new to coding so I definitely need to spend some more time learning it. But if anyone could help me out real quick so I can get this landing page going that would be great.

Here is the code from the original file I'm trying to edit:

<span class="mid-hldr-right">
<div class="clear3"></div>
<span class="ln5">Looking for Casual Sex<br />
in Wellington?</span>


In place of Wellington I want to put the php script. So I ended up with this:

<span class="mid-hldr-right">
<div class="clear3"></div>
<span class="ln5">Looking for Casual Sex<br />
in
<?php
$geo = geoip_record_by_name( $_SERVER['REMOTE_ADDR'] );
echo "".$geo['city']."?" ;
?>
</span>

this is how ln5 is defined in the css file.

.ln5 { display:block; color:#f05f64; font-size:43px; text-align:center; font-weight:bolder; }


08-10-2012 07:02 AM #6 snipe (Member)

This should work:

[PHP]
<?php
$geo = geoip_record_by_name( $_SERVER['REMOTE_ADDR'] );
$city= $geo['city'];
?>

<style>.ln5 { display:block; color:#f05f64 !important; font-size:43px !important; text-align:center !important; font-weight:bold !important;}</style>

<span class="mid-hldr-right">
<div class="clear3"></div>

<span class="ln5">Looking for.. ahem</span><br />
<span class="ln5">in <?php echo $city; ?>?</span>

</span>[/PHP]


Home > Questions and Answers > General Questions