Page 2 of 2

Re: Question here for you guys with knowledge on PHP capabil

Posted: Wed Oct 12, 2011 7:29 pm
by Apollo
grabber_grabbs wrote:ON the net, they have this example (this is to put some php code in a html document.)
If by "html document" you mean the file is still a .htm or .html file, it won't work. You have to give it a .php extension for Apache to know to actually parse the file as PHP.

So it really works the other way round: you can put HTML in a PHP file.

Re: Question here for you guys with knowledge on PHP capabil

Posted: Wed Oct 12, 2011 7:44 pm
by grabber_grabbs
well, i can try, but most of the code is html....
<html>
<head></head>
<body class="page_bg">
Hello today is <?php echo date('l, F jS, Y'); ?>.
<?php echo "have a nice day"; ?>
</body>
</html>

Re: Question here for you guys with knowledge on PHP capabil

Posted: Wed Oct 12, 2011 7:46 pm
by grabber_grabbs
gosh... with the php extension... it worked !!!!


why now ?

Re: Question here for you guys with knowledge on PHP capabil

Posted: Wed Oct 12, 2011 7:49 pm
by Celauran
What do you mean 'why now'? As Apollo explained, Apache needs the .php extension to recognize that the page contains PHP code and have it interpreted accordingly.

Re: Question here for you guys with knowledge on PHP capabil

Posted: Wed Oct 12, 2011 9:46 pm
by grabber_grabbs
thanks for the info.
What puzzle me though is why when someone click on the link i just gave, they see good results, but if i do the same here, it doesnt work

www.caraquetvacances.com/test.html

does not work here, but, it you click on the link above... do you get something ?

I would assume that the appache server (like you called) should recognize the same thing, no matter who is calling...

thanks all for the help

Re: Question here for you guys with knowledge on PHP capabil

Posted: Thu Oct 13, 2011 5:50 am
by Apollo
The link you posted there is a .html file. Again, this won't work!

Unless you did some trickery to internally redirect that (using mod_rewrite) to a .php file, or reconfigured Apache to parse .html as PHP well (neither of which is the case), this means your webserver (Apache) will parse it as HTML, not as PHP.

Forget about .htm or .html, just don't use it. Not in filenames, not in links.

Re: Question here for you guys with knowledge on PHP capabil

Posted: Thu Oct 13, 2011 1:23 pm
by grabber_grabbs
Apollo, and all the other posters, thanks for your help.
all is fine now.

Re: Question here for you guys with knowledge on PHP capabil

Posted: Thu Oct 13, 2011 2:30 pm
by pickle
The conversation has drifted a bit from this point, but I would recommend not using a database for this - there's no benefit. You don't need to do relational queries, so you don't get any benefit. Since the data isn't really dynamic, there's no point in wasting clock cycles building the page dynamically.

My recommendation would be to stick with importing the CSV, and have your PHP script generate static HTML that you then incorporate into your website.

As your your current problem ~grabber, servers generally only know to parse PHP code if the file ends in .php. If it ends in .html, the server thinks it's just html/text, and sends it to the browser. If it sees .php, it knows it needs to inspect the file & execute any PHP code it finds.

Re: Question here for you guys with knowledge on PHP capabil

Posted: Thu Oct 13, 2011 9:11 pm
by grabber_grabbs
isnt it easier to import the CSV into the SqL table...then, lots of tools are available to manage the data.... it would also be easier sorting the info and also easier for a search engine to screen data....

Re: Question here for you guys with knowledge on PHP capabil

Posted: Fri Oct 14, 2011 10:04 am
by pickle
If you're doing dynamic things to the info (like sorting & searching), then ya, a database would be best. If you're just showing the information, just stick with the CSV.