1
robotgod2000
Help using css with php

Hi,

I've got a custom php block that links to a non-xoops application, passing the XOOPS user id and password to this other application. It works great, BUT I can't seem to get the php code to take in formatting from my .css. I'd like this left custom block to match my left user menu.

This is the code.

global $xoopsUser;
function 
Encrypt($string$key="xxxxxx") {
    
$result '';
    for(
$i=1$i<=strlen($string); $i++) {
        
$char substr($string$i-11);
        
$keychar substr($key, ($i strlen($key))-11);
        
$char chr(ord($char)+ord($keychar));
        
$result.=$char;
    }
    return 
$result;
}
echo 
"<a class=menuTop id=usermenu href='/timesheet/index_user.php?login=".Encrypt($xoopsUser->getVar('uname'))."&password=".Encrypt($xoopsUser->getVar('pass'))."&ref=".Encrypt($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'])."'>My Timesheet</a>";

Note this part of it isn't taking:

echo "<a class=menuTop id=usermenu

What am I missing? Is there a global I need to include?

Thx

2
rowdie
Re: Help using css with php
  • 2005/1/10 16:52

  • rowdie

  • Just can't stay away

  • Posts: 846

  • Since: 2004/7/21


The css style in the default theme is
td#mainmenu a.menuTop

You're missing the table td html tags...

solution: either put your output in a table, or change the class

3
studioC
Re: Help using css with php
  • 2005/1/10 17:21

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


hi,

i'm not familiar within php but ..
Quote:
echo "<a class=menuTop id=usermenu

shouldn't that be:

echo "<a class='menuTop' id='usermenu' .....</a>"

michael

4
robotgod2000
Re: Help using css with php

Thanks for the tip. I added a new class to my .css for "a" tags:

a#phpusermenu a {
    
background#F6F8FA;
    
font-weightnormal;
    
padding0px 0px 0px 30px;
    
border-right1px solid #D9E3EB;
    
border-bottom1px solid #D9E3EB;
    
border-left1px solid #D9E3EB;
    
border-top1px solid #D9E3EB;
    
width120px;
    
color#666666;
}
a#phpusermenu a:hover {
    
background-color#FFFFFF;
    
text-decorationnone;
    
border1px solid #8CA9C1;
    
color#799BB7;
}

a#phpusermenu a.highlight {padding-left: 30px;background-color: #fcc; border-right: 1px solid #666666; border-bottom: 1px solid #ADACAD; border-left: 1px solid silver;text-decoration: none;}

Shouldn't this work? It doesn't.
echo "<a id=phpusermenu href='/timesheet/index_user.php?login=".Encrypt($xoopsUser->getVar('uname'))."&password=".Encrypt($xoopsUser->getVar('pass'))."&ref=".Encrypt($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'])."'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;My Timesheet</a>";

Thx.

5
robotgod2000
Re: Help using css with php

I think the single quotes are optional there. Anyway I tried with single quotes and got the same, non-formatted result.

Thx.

6
rowdie
Re: Help using css with php
  • 2005/1/10 17:39

  • rowdie

  • Just can't stay away

  • Posts: 846

  • Since: 2004/7/21


try making your class without an id

.phpusermenu a {}

then use <a class='phpusermenu' ...

id's are unique, they should only be used once in a page. It's easier to just make it a class.

Hope this helps,
Rowd

7
robotgod2000
Re: Help using css with php

Quote:

rowdie wrote:
try making your class without an id

.phpusermenu a {}

then use <a class='phpusermenu' ...

id's are unique, they should only be used once in a page. It's easier to just make it a class.

Hope this helps,
Rowd


Done...but still no formatting change. Any other ideas?

Thanks for the help anyway!

RBG