Forum Moderators: coopster
In one style sheet I set the look for list items in menu.php, but after adding some more list items- I wanted to change the look and feel of those additions. I tried making another class for them and adding them in menu.php, but it was a no go.
Do you have to leave PHP mode in order to apply styles in a script?
Thanks
You can use css the same with php as you do with straight html.
Can you clarify a bit? It sounds like you are having a css prob not php. What do you mean by leave php?
If you mean ?> and then do the css stuff and then <? then that is probably true. Not totally sure what you mean.
<a href=\"somedoc.php\" class=\"mylink\">My Page</a>
This is what I hope to do with PHP...$somedoc.css being the variable.
Madcat, if you want CSS to apply to a certain area, just use PHP to output that particular style in your head section. Otherwise just break out of PHP and use "normal" HTML code
....and I thought I had the monoploly on confusing posts
Is the code above the preferred way?
<body>
<a href="somedoc.php" class=<?php echo $myclass; ?>>My Page</a>
</body>
Or you could wrap you're php script around the link like this:
<?php
if ($somevar == $anothervar) {
?>
<a href="somedoc.php" class="mylink">My Page</a>
<?php
}
else
?>
<h4>No Link Available</h4>
<?php
//the rest of your php script...
[edited by: lorax at 6:48 pm (utc) on Aug. 25, 2002]
Here's another use one you might not know...
Isn't that the story;)
I simply created sub-classes and applied them correct:
li.sub_net{
font: .9em verdana, helvetica, sans-serif;
background: #ffc;
padding: 6px 0 6px 10px;
}
echo ("<li><a href='index.html?networking=1'>" . "Networking" ."</a></li>");
if (isset($_GET['networking'])) {
echo ("<li class='sub_net'><a href='index.html' class='sub_net'>" . "Pricing" . "</a></li>");
}
Great suggestions for implementing style above.
M