1
FMule
Print code based on url
  • 2005/9/4 18:50

  • FMule

  • Just popping in

  • Posts: 37

  • Since: 2004/10/22


Hi,

i want to customize the image bakground of a "div" tag in theme.html

I want to read the page url and select the case to show different immage/stile for a div.

For example if i'm in:
"/modules/pagine/index.php?pagenum=2"
I want to see in the theme.html:
<div id="sfondotestata">Home Page / LINKS </div>

else in:
"/modules/pagine/index.php?pagenum=3"
i want in theme.html the code:
<div id="sfondotestata2">Home Page / LINKS2 </div>

else in:
"modules/liaise/?form_id=2"
i want in theme.html the code:
<div id="sfondotestata3">Home Page / Contatti </div>

for the default case i want:
<div id="sfondotestatadefaul">Home Page / Contatti </div>

these for 15 case about.

Someone have an idea to help me?
I can read the url after $xoops_url?

Tks.

2
adrock
Re: Print code based on url
  • 2005/9/4 20:36

  • adrock

  • Quite a regular

  • Posts: 291

  • Since: 2004/12/7


Maybe Lazy Badgers groovy custom theme set-up will work for you...with some modification.

Check it out here: Thread Link
Affordable Web Hosting - Family - Fun!...and not always in that order!

3
FMule
Re: Print code based on url
  • 2005/9/5 9:24

  • FMule

  • Just popping in

  • Posts: 37

  • Since: 2004/10/22


it'snt good because the condition espressed in the example is on the name of the block. In my case the condition is on a specific url adress!

I build these code:

<{php}>
$urlici= "http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

echo "<div style='background-image: url(.$xoops_imageurl.images/corpo_testata.jpg); height: 80px; padding-left: 70px; padding-right: 70px; text-align: right;'><br /><br /><br /><br /> <a href='/'>Home Page</a> / <B>LINKS2</B> </div>";
switch ($urlici) {

case 'http://127.0.0.1/DxoopsTest/modules/wfsection/article.php?articleid=2':
echo('<div style=background-image: url(<{$xoops_imageurl}>images/corpo_testata.jpg); background-repeat: no-repeat; height: 80px; padding-left: 70px; padding-right: 70px; text-align: right;><br /><br /><br /><br />Home Page / LINKS </div>');
break;

case 'http://127.0.0.1/DxoopsTest/modules/wfsection/article.php?articleid=1':
echo('<div style="background-image: url(http://127.0.0.1/DxoopsTest/themes/PitPrincipale/images/corpo_testata.jpg); height: 80px; padding-left: 70px; padding-right: 70px; text-align: right;"><br /><br /><br /><br /> <a href="/">Home Page</a> / <B>LINKS2</B> </div>');
break;
default:echo('default');
}


// if ($urlici == 'http://127.0.0.1/DxoopsTest/modules/wfsection/article.php?articleid=1' ){echo('ok');}
<{/php}>

but there are some sintax error because the smarty tag "(<{$xoops_imageurl}>" return nothing!

ca you help me?

4
adrock
Re: Print code based on url
  • 2005/9/5 9:41

  • adrock

  • Quite a regular

  • Posts: 291

  • Since: 2004/12/7


Quote:
'background-image: url(.$xoops_imageurl.images/corpo_testata.jpg);


leave it in the smarty format while in the 'echo' process.

change to:

Quote:

url(<$xoops_imageurl>images/corpo_testata.jpg);
Affordable Web Hosting - Family - Fun!...and not always in that order!

5
FMule
Re: Print code based on url
  • 2005/9/5 11:08

  • FMule

  • Just popping in

  • Posts: 37

  • Since: 2004/10/22


insn't ok!
the code:

echo('<div style="background-image: url(<$xoops_imageurl>images/corpo_testata.jpg); height: 80px; padding-left: 70px; padding-right: 70px; text-align: right;"><br /><br /><br /><br /> <a href="/">Home Page</a> / <B>LINKS2</B> </div>');
break;


return:
<div style="background-image: url(<$xoops_imageurl>images/corpo_testata.jpg); height: 80px; padding-left: 70px; padding-right: 70px; text-align: right;"><br /><br /><br /><br /> <a href="/">Home Page</a> / <B>LINKS2</B> </div>


why?

6
adrock
Re: Print code based on url
  • 2005/9/5 19:45

  • adrock

  • Quite a regular

  • Posts: 291

  • Since: 2004/12/7


if I'm not mistaken, the echo command will simply echo what is placed there...so for those tags to work etc, you will need to include the <html> and <body tags> etc. I would attempt this with something other than the echo command.
(sorry, I know html and smarty interaction, and little php other than top level understanding of functionality)
Affordable Web Hosting - Family - Fun!...and not always in that order!

7
FMule
Re: Print code based on url
  • 2005/9/6 11:34

  • FMule

  • Just popping in

  • Posts: 37

  • Since: 2004/10/22


I find the solution:

i must use the global XOOPS variable in echo command. so i must use $xoops_url ed not <{$xoops_url}>

tks.

8
davidl2
Re: Print code based on url
  • 2005/9/6 11:59

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


Fmule - can you show us the code you used?

This may be useful for others.. like myself

9
FMule
Re: Print code based on url
  • 2005/9/6 16:16

  • FMule

  • Just popping in

  • Posts: 37

  • Since: 2004/10/22


Sure...

before was:
echo('<div style="background-image: url(<$xoops_imageurl>images/corpo_testata.jpg); height: 80px; padding-left: 70px; padding-right: 70px; text-align: right;"><br /><br /><br /><br /> <a href="/">Home Page</a> / <B>LINKS2</B> </div>');
break;


Now:

echo('<div id="linkmenu2" style="background-image:url('.XOOPS_URL.'/themes/PitPrincipale/images/x_cantieri.jpg);">... etc.

Login

Who's Online

196 user(s) are online (127 user(s) are browsing Support Forums)


Members: 0


Guests: 196


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits