Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 29, 2012, 05:14 PM   #1
larswik
macrumors 65816
 
Join Date: Sep 2006
PHP - dynamicly inserting table elements

I am moving a long with my project and came into a snag again. I have a number of clients which have images in a folder from 3 to 10 photos. I am tryign to create a dynamic table in HTML with PHP code embedded to get the right number of photos in to the table.

If I use this line of code all by it's self in a table it works fine and the photo displays with the PHP tags.
Code:
<TD><IMG SRC="<?php echo $linksArray[0]; ?>" HEIGHT=213 WIDTH=320 ALIGN=left HSPACE=10 VSPACE=10><TD>
But if I wrap this in php tags to echo out the code the image will not show?

Code:
<?php
	echo '<TD><IMG SRC= " <?php echo $linksArray[0]; ?>" HEIGHT=213 WIDTH=320 ALIGN=left HSPACE=10 VSPACE=10></TD>';
?>
The end result with be a "foreach" loop for each photo that is in the client folder.
__________________
I know more than yesterday.
Lars

Last edited by larswik; Jun 29, 2012 at 05:25 PM.
larswik is offline   0 Reply With Quote
Old Jun 29, 2012, 06:07 PM   #2
elppa
macrumors 68040
 
elppa's Avatar
 
Join Date: Nov 2003
You can't nest the php tags.

Use a period to concatenate:

PHP Code:
<?php
    
echo '<TD><IMG SRC="'.$linksArray[0].'" HEIGHT=213 WIDTH=320 ALIGN=left HSPACE=10 VSPACE=10></TD>';
?>
or this will work:


PHP Code:
<?php
    
echo "<TD><IMG SRC=\"{$linksArray[0]}\" HEIGHT=213 WIDTH=320 ALIGN=left HSPACE=10 VSPACE=10></TD>";
?>
elppa is offline   0 Reply With Quote
Old Jun 30, 2012, 12:38 AM   #3
larswik
Thread Starter
macrumors 65816
 
Join Date: Sep 2006
Gotcha, that fixed the problem.

Good to know

Thanks!
__________________
I know more than yesterday.
Lars
larswik is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
[php] - php problems os x mountain lion 10.8.2 cakas6933 OS X 10.8 Mountain Lion 4 Jun 10, 2014 09:08 AM
iPhone: Periodic Table of Elements MagnumOP UI Customization 10 Aug 8, 2013 09:51 PM
Can I install Photoshop Elements & Premiere Elements 11 on Macbook Air 2012? janjan77 MacBook Air 3 Mar 30, 2013 02:44 PM
rMBP13 - Aperture or Elements/Priemer Elements RickG MacBook Pro 9 Nov 2, 2012 10:33 AM
MySQL Result in PHP/HTML Generated Table - Click Row To Edit? Kilamite Web Design and Development 5 Jul 26, 2012 01:48 PM

Forum Jump

All times are GMT -5. The time now is 02:15 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC