| | |
Setting a Background Image problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: May 2008
Posts: 67
Reputation:
Solved Threads: 3
Hi All,
I am trying to set background image. I retreived it from the database into $xyzimage variable and then trying it to display in the <body > tag.
When i am trying to display it a tabel cell like <td> it works, but not in <body> tag.
Is there a specific way to do this other than :
The same $image works while put in a table cell.
Thankyou all in advance.
I am trying to set background image. I retreived it from the database into $xyzimage variable and then trying it to display in the <body > tag.
When i am trying to display it a tabel cell like <td> it works, but not in <body> tag.
Is there a specific way to do this other than :
php Syntax (Toggle Plain Text)
$xyzimage; //retreived it from database echo '<body BACKGROUND='.$xyzimage.'>';
Thankyou all in advance.
Kavitha
I Love My Indonesia.
I Love My Indonesia.
Well it could be because the "BACKGROUND" attribute hasn't been used in about 10 years.
php Syntax (Toggle Plain Text)
<style type="text/css"> background-image:url('<?php echo $xyzimage ?>'); </style>
Last edited by ShawnCplus; Dec 5th, 2008 at 4:21 pm.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
Join Date: May 2008
Posts: 67
Reputation:
Solved Threads: 3
•
•
•
•
Well it could be because the "BACKGROUND" attribute hasn't been used in about 10 years.
php Syntax (Toggle Plain Text)
<style type="text/css"> background-image:url('<?php echo $xyzimage ?>'); </style>
Getting error when i use it..
css Syntax (Toggle Plain Text)
<style type="text/css"> background-image:url('<?php echo $profpic ;?>'); </style>
Parse error: syntax error, unexpected '<'
Last edited by peter_budo; Dec 6th, 2008 at 5:15 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Kavitha
I Love My Indonesia.
I Love My Indonesia.
heh, the style tags can't show up in PHP code.
For future reference echoing out HTML in PHP can create some serious spaghetti code so you should avoid it if possible.
So instead of echoing you would close your PHP tag, then put in those style tags, then re-open your PHP tags
For future reference echoing out HTML in PHP can create some serious spaghetti code so you should avoid it if possible.
So instead of echoing you would close your PHP tag, then put in those style tags, then re-open your PHP tags
php Syntax (Toggle Plain Text)
// some code ?> <style type="text/css"> ... </style> <?php // rest of your code
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
If you're inside a PHP script you can open and close your PHP tags as much as you want. Anything not inside the tags will be rendered to the browser as text just as if it were in an HTML file.
The code
The code
<?php echo $xyzimage ?> in the CSS is what puts the background image in the CSS GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Just do this if you want to assign it to the body:
Note: This should go in the head of the document.
php Syntax (Toggle Plain Text)
<style type="text/css"> body{ background-image:url('<?php echo $profpic ;?>'); } </style>
Lost time is never found again.
- Benjamin Franklin
- Benjamin Franklin
•
•
Join Date: May 2008
Posts: 67
Reputation:
Solved Threads: 3
Can someone tell me Whats wrong with the below part of the code
(
I keep getting parse error
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'
the above code is the part which keep giving me Parse error as mentioned above.
Any help is appreciated.
Thankyou
(I keep getting parse error
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'
php Syntax (Toggle Plain Text)
//part of the code echo ' </head> '; //$home variable is retrieved from a db switch ($homelay){ case 1: echo "<body BACKGROUND="bckgnd\bg1.jpg">"; break; case 2: echo "<body BACKGROUND="bckgnd\bg2.jpg">"; break; case 3: echo "<body BACKGROUND="bckgnd\bg3.jpg">"; break; default: echo "<body BACKGROUND="bckgnd\bg2.jpg">"; break; } echo ' <table>'; // rest of the code
the above code is the part which keep giving me Parse error as mentioned above.
Any help is appreciated.
Thankyou
Kavitha
I Love My Indonesia.
I Love My Indonesia.
•
•
Join Date: May 2008
Posts: 67
Reputation:
Solved Threads: 3
•
•
•
•
Just do this if you want to assign it to the body:
Note: This should go in the head of the document.php Syntax (Toggle Plain Text)
<style type="text/css"> body{ background-image:url('<?php echo $profpic ;?>'); } </style>
i keep getting same parse error ..
when i tried this one
Kavitha
I Love My Indonesia.
I Love My Indonesia.
![]() |
Similar Threads
- MDI Parent Form Layout Problem (VB.NET)
- Desert Island problem in Java3D (Java)
- Small problem face me (C#)
- Aligning tables inside tables by height (HTML and CSS)
- sdl_ttf not working (C++)
- Problems with CSS in IE (HTML and CSS)
- Css Fixed Background Attachment (Site Layout and Usability)
- expanding site content with css (HTML and CSS)
- Office Templates + Background Image (Windows Software)
- GUId Greif! (Java)
Other Threads in the PHP Forum
- Previous Thread: is java page session_id and php page session_id is equal
- Next Thread: Special characters?
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary body broken cakephp checkbox class cms code cron curl database date date/time directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail menu mlm mod_rewrite msqli_multi_query multiple mycodeisbad mysql oop parse paypal pdf php problem query radio random recursion regex remote script search send seo server sessions sms soap source space sql static structure syntax system table tutorial update upload url validation validator variable video web webdesign wordpress xml youtube






