PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hello,
Wonder if any one would help , I have a directoty of images on my server and the images are referenced in the database but what Im trying to do is to check whether an image exists using the file_exist function. if the image does not exist replace with a default.
Here is my code
You still use short PHP tags? To quote the PHP manual:
Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags.
so it is to my understand that popping in and out of HTML and PHP is what short tags are... correct?
using tables in HTML as opposed to echoing all structure.
i get that, i think.
why is that so bad? it makes for sloppy code? or it is harder to read in older versions?
if i am only working on one system, then what does it matter if it isn't portable?
these are not snotty questions, they are asking for comprehension only...
i'm still newbie, yes? i need to better understand this jive.
$var wrote:
so it is to my understand that popping in and out of HTML and PHP is what short tags are... correct?
Incorrect. These are short tags <? ?> these are normal tags <?php ?>
$var wrote:
but if your server is set to accept both those, and it's a server side application... then it should be fine right?
Its the whole idea of compatability.
But I mean, why use short tags when there is a chance they are off...
What if you switch to a server that has them turned off. Time to go through my hundreds of files and edit them? of course this could be easily automated to replace them
Last edited by John Cartwright on Tue Oct 25, 2005 3:08 pm, edited 1 time in total.
$var wrote:but if your server is set to accept both those, and it's a server side application... then it should be fine right?
In my opinion .. no. It's only fine *at the moment*. If for some reason you change to a host that doesn't allow short PHP tags, or you no longer control the server, then the code would have to be modified. By using <?php ?> tags from the outset you avoid future problems.
Also, I can foresee a time when <? ?> tags are no longer supported by PHP itself .. the clash with XML tags is very annoying at times (well.. it was once ).