/    Sign up×
Community /Pin to ProfileBookmark

Can I put a CSS rolover code in this php script?

Hi! I have a CSS image rollover script I am using for the menus on a joomla webpage. I’m also have a login/logout “module” that is written in PHP. The PHP login/logout “module” is essentially a form.

Is there a way to use the CSS image rollover script in the PHP form so the submit buttons will be rollover buttons?:eek:

I hope that makes sense. Here’s the CSS rollover script I use for the menu:

[CODE]
<style type=”text/css”>
a.logout{
width:136px;
height:30px;
background:url(http://www.faithworksnow.com/images/menu/logout.gif) 0 0;
display:block;
text-indent:-1500px;
overflow:hidden;
}
a.logout:hover { background-position: -136px 0;}
</style>

<a class=”logout” width=’136px’ href=”(I’m not sure)”></a>
[/CODE]

I can give you the entire code from the PHP login/logout, but it is very long. Here’s a small bit of it where the submit button is:

[CODE]
echo ‘<input type=”image” name=”Submit” src=”http://www.faithworksnow.com/images/menu/logoutoff.gif” width=”130″ height=”30″ class=”button’.$class_sfx.'” value=”‘._BUTTON_LOGOUT.”” />”;

echo “n”.'<input type=”hidden” name=”op2″ value=”logout” />’.”n”;

echo ‘<input type=”hidden” name=”lang” value=”‘.$mosConfig_lang.'” />’.”n”;

echo ‘<input type=”hidden” name=”return” value=”‘ . $logout . ‘” />’.”n”;

echo ‘<input type=”hidden” name=”message” value=”‘ . htmlspecialchars( $message_logout ) . ‘” />’.”n”;

if ( is_callable(“josSpoofValue”)) {

$validate = josSpoofValue();

echo “<input type=”hidden” name=”” . $validate . “” value=”1″ />n”;

}

[/CODE]

Thankyou very much for the help!
Ben

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@benrussellauthorDec 02.2008 — I got it!

[CODE]
echo '<STYLE TYPE="TEXT/CSS">';
echo '#logout{';
echo 'width:136px;';
echo 'height:30px;';
echo 'background:url(http://www.faithworksnow.com/images/menu/logout.gif) 0 0;';
echo 'display:block;';
echo 'text-indent:-1500px;';
echo 'overflow:hidden;';
echo '}';
echo '';
echo '#logout:hover { background-position: -136px 0;}';
echo '';
echo '</STYLE>';
echo '<DIV><input type="image" name="Submit" ID="logout" src="http://www.faithworksnow.com/images/blank.png" class="button'.$class_sfx.'" value="'._BUTTON_LOGOUT."" /></DIV>";

[/CODE]


Looks kinda hairy, but I had to keep a blank image in there so IE7 wouldn't show the "logout" ID over the image. I'm soooo excited!!!!
Copy linkTweet thisAlerts:
@OctoberWindDec 02.2008 — just a couple of things:

[code=php]echo ''; [/code]
is useless. No need to tell PHP to echo a blank line.

Also, you can write plain HTML/CSS around your PHP code, so you don't have to echo each line, and worry about mixing single and double quote, or escaping things.

You can close you current PHP segment with [b] ?> [b] enter your HTML/CSS and reopen the PHP with [b]<?php[/b] and resume your PHP code. Besides, CSS style blocks reside in the <head> section, and not in the <body>.
×

Success!

Help @benrussell spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...