News:

The anti-spam plugins have stopped being effective. Registration is back to requiring approval. After registering, you must ALSO email me with your username, so that I can manually approve your account.

Main Menu

I need a little help with a PHP script

Started by Cammiluna, December 02, 2007, 10:26:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Cammiluna

I'm in the process of editing my pages. For the most part, it's going okay, but there's this one script I have that completely stopped working.  It's a page with a very small script I use for my art galleries and it allows me to display images and titles to that page without creating a new HTML page for every last image.

It starts off with this:
<?php

if ($_REQUEST['srcs']) {
   ?>


And the second part is this:
<img src="http://cammiluna.xepher.net/portfolio/<?=$_REQUEST['srcs']?>">

It worked just dandy before the server moved, but now any image I load on that page is broken and adding "php" to the request code in the URL isn't doing anything but giving me errors for the "=" in it.  I get rid of the "=" and it's back to the broken image.  I checked the image properties and it asks for that exact url instead of the url for the image I called for.

Is there a possible solution to this? Thanks in advance! <3




Xepher


Cammiluna

Wow!

I'm totally up to speed now!  Thanks a TON!

Databits

Using <?=$var?> is a totally valid and widely used php variable output method. If it doesn't work your php installation needs to be configured correctly Xeph. :P
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

Xepher

#4
Using <?=$var?> is only valid if/when the short_open_tag setting is enabled. And if you enable that setting, you then bork any xml pages, since they use the tag <?xml to open code blocks. Granted, you can escape the XML blocks inside a php block using echo, but then "<?='<?xml'?>" is starting to look as unreadable as perl. :-) Bottom line is I can choose to break pages that use the lazier short tags, or break pages that use the lazier (non-escaped) XML tags. (Any code that uses the longer options is, of course, fine either way.) I think no short tags ultimately makes code more readable, so I went that route for the default, but like most things on xepher.net, I try to give as much flexibility as possible. Thus, the short_open_tag setting (along with most others) can be (or at least should be able to be... I haven't actually tried it) overridden in a .htaccess file if you want. http://us2.php.net/manual/en/ini.php has some info on that.