Jump to content

Recommended Posts

I need some php help! I think it's a simple problem (something to do with my environment, maybe apache setup, is my guess), but the answer is escaping me.

I'm trying to use a script for automatically generating galleries using these:

Tutorials -

http://scriptandstyle.com/automatically-generate-a-photo-gallery-from-a-directory-of-images

http://davidwalsh.name/generate-photo-gallery

My code -

http://pastebin.com/S67hTczf

Online syntax checker http://tools.sopili.net/php-syntax-check/ confirms that my php is valid.

 

Issue -

Firefox breaks the script in the first echo (line 75), at the call of  href="',$images_dir.$file,'"  - it breaks off at $images_dir.| and prints the rest of the script starting at |$file on the page.  The last echo works, but the script calling it is still printed to screen.  Examining the page source with firefox's source viewer shows the php as functioning up until the foreach statement (line 65), truncating the php at $index=> .

I downloaded the example dir from the first tutorial, which comes with images css etc all set up, and it truncates in a similar way, spilling the remaining script onto the page.

The fact that the given tutorial creates a similar issue leads me to conclude that my environment is incorrectly configured, but I don't know in what way.

 

tungsten

Link to comment
https://forums.phpfreaks.com/topic/239306-strange-newbie-problem-syntax-or-setup/
Share on other sites

Php is a web server scripting language. What URL are you entering in your browser? It should be something like http://localhost/your_file_name.php

I'm opening the file with a browser, so the path I'm using starts with "file:///"

 

I think I've missed something crucial here; should I be using apache to virtually host the files?  (note that I may be an idiot)

If so I'll see if I can sort that out.

 

Edit:  I have since discovered that this is the case and am now continuing to configure my environment

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.