TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-18-2008, 11:18 PM   #1 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 28
Thanks: 9
bmathers is on a distinguished road
Default stupid simple question

how can i output an image in this code;

PHP Code:
$config["M_Paintball_100"]="
<h1>Times:</h1> 9.45am – 2pm or 11.30am – 3.30pm on a half day, full day 9.45am – 3.30pm.
"

everything ive tried doesnt seem to work. This code is a snippet from a message pop up box that is called when clicked on.
bmathers is offline  
Reply With Quote
Old 02-18-2008, 11:54 PM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Which image? Where you getting the image from?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 02-19-2008, 08:12 AM   #3 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 28
Thanks: 9
bmathers is on a distinguished road
Default

Quote:
Originally Posted by Wildhoney View Post
Which image? Where you getting the image from?
just an imagein my images folder, the code above is one of many in a file called message.oho, which is called when the user clicks to find more information
bmathers is offline  
Reply With Quote
Old 02-19-2008, 01:28 AM   #4 (permalink)
The Acquainted
 
Join Date: Sep 2007
Location: Arizona
Posts: 114
Thanks: 10
Andrew is on a distinguished road
Default

Code:
<img src="path/to/image.gif" alt="Alt text" />
Like that?
Send a message via AIM to Andrew Send a message via MSN to Andrew
Andrew is offline  
Reply With Quote
Old 02-19-2008, 08:12 AM   #5 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 28
Thanks: 9
bmathers is on a distinguished road
Default

thats what i thought but its not working, ive tried this but cant get it too work

PHP Code:
$config["M_Paintball_100"]="
<h1>Times:</h1> 9.45am – 2pm or 11.30am – 3.30pm on a half day, full day 9.45am – 3.30pm.</br><br>
<img src="
../images/stag.gif"/>"
bmathers is offline  
Reply With Quote
Old 02-19-2008, 09:18 AM   #6 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

php Code:
$config["M_Paintball_100"] = '<h1>Times:</h1> 9.45am – 2pm or 11.30am – 3.30pm on a half day, full day 9.45am – 3.30pm.<br /><br />
<img src="../images/stag.gif"/>'
;
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
bmathers (02-19-2008)
Old 02-19-2008, 09:27 AM   #7 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 28
Thanks: 9
bmathers is on a distinguished road
Default

can you explain what the difference is between the single and double qoutes, sorry for being simple, justtrying to understand everything.
bmathers is offline  
Reply With Quote
Old 02-19-2008, 10:55 AM   #8 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

Quote:
Originally Posted by bmathers View Post
can you explain what the difference is between the single and double qoutes, sorry for being simple, justtrying to understand everything.
Double quotes can be used like this;
PHP Code:
echo "Hello, my name is $name."
This most likely, when defined $name, exports Hello, my name is insert_name_here

The same doesn't go for the single quotes although they are a lot easier to use. Since you'll make echo's like this;
PHP Code:
echo '<a href="link.htm">link</a>';
// and of course
$query mysql_query('SELECT * FROM table WHERE name = "'.$name.'"'); 
Adam would be more qualified to explain it into more depth but those are the basics really. Also, double quotes understand the usages of "\n" (HTML Enter) and "\r" (HTML Tab).

Good luck!
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 02-19-2008, 02:27 PM   #9 (permalink)
The Acquainted
 
Join Date: Nov 2007
Posts: 154
Thanks: 31
SOCK is on a distinguished road
Default

... that's correct ReSpawN, but I think the real issue was non-escaped double quotes. That's the reason Wildhoney corrected the string.

In any event, bmathers, you should spend some time reading through the PHP Manual, especially the language reference.
__________________
I reject your reality, and substitute my own.
SOCK is offline  
Reply With Quote
Old 02-19-2008, 03:35 PM   #10 (permalink)
The Contributor
 
flyingbuddha's Avatar
 
Join Date: Jan 2008
Location: Birmingham, UK
Posts: 60
Thanks: 10
flyingbuddha is on a distinguished road
Default

Just to expand on Sock's explanation a tiny bmathers, using quotes inside quotes (as with your example), you're causing confusion to the interpreter, it doesn't know when the sentence is ending and when it's beginning.

That means it's taking '../images/stag.gif' and trying to parse/ call it rather than outputting it, as you're intending.

Couple of bits re. ReSpawn's points,

1. If you use a variable in a string, enclose it in curly braces:
PHP Code:
// not strictly necessary but easier to spot
echo "Hello, my name is {$name}."
2. There's a slight performance benefit from using apostrophe's over quotes when dealing with strings. Apostrophe's are taken as literals so it doesn't try to parse data as strings in quotes' do.
__________________
Pro. Geek
http://www.mikeholloway.co.uk
flyingbuddha is offline  
Reply With Quote
Old 02-19-2008, 07:34 PM   #11 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

I also published a little article on double and single quotes over here.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
ReSpawN (02-19-2008)
Old 02-19-2008, 07:49 PM   #12 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

You should built in a feature when the post is one above the poster, auto add a thanks.
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 08:08 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design