Kolusion
-
Posts
30 -
Joined
-
Last visited
Never
Posts posted by Kolusion
-
-
I am new to PHP and wasting no time have jumped into creating my own database system. Its actually a psuedo-database, but who cares it works. I've done something some-what similar in Python but with a static single file database.
What I have is directories as like:
./1/index.listing
./2/index.listing
./3/index.listing
The numbers are a product... product 1, product 2, you know..
What I want to do is on the product category page, using:
include('./*/index.listing');
.. where * would mean for PHP to scan all relative directories and include 'index.listing', which will result in a list being built for the product category, showing all the available products.
There is probably some way to do this in MySQL, but I am already familiur with this style of database, so why waste more Saturday nights learning something I don't have to when I could be out getting drunk and partying with girls 10 years younger than me. LuLz
-
Hey dude,
haha yeah the problems resolved now. What I actually did was allow .html files to be executed as PHP from httpd.conf (Apache)
Thanks anyhow!
-
I don't have time to learn every bit of PHP.. only the things I need.
Why do you say MySQL for lots of items?
-
Just to let you know, the code above has been fragmented by this website.
The untouched file is hosted here:
http://www.qfpost.com/download.do?get=1fe261dc5fa32a907c8cb2b4cd7ac354
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <TITLE>X</TITLE> <META content="charset=windows-1252;text/html" http-equiv="content-type"> <STYLE type="text/css"> BODY { background-attachment:fixed; background-image:url("/bodybackground.png"); background-position:center; background-repeat:no-repeat; font-family:verdana } IMG.logo { left:50%; margin-left:-635px; margin-top:-355px; position:absolute; top:50% } SPAN.accountmenu { left:50%; margin-left:589px; margin-top:-352px; position:absolute; top:50% } SPAN.mainmenu { left:50%; margin-left:374px; margin-top:-331px; position:absolute; top:50% } A.silver { color:silver; } TABLE.main { background-color:gold; height:636px; left:50%; margin-left:-635px; margin-top:-307px; position:absolute; top:50%; width:1270px } A.legal { color:silver; left:50%; margin-left:-90px; margin-top:334px; position:absolute; top:50% } </STYLE> <DIV> <IMG alt="" class="logo" src="../../../logo.png"> <SPAN class="accountmenu"> <A class="silver" href="/login">Login</A> </SPAN> <SPAN class="mainmenu"> <A class="silver" href="/contact">Contact</A> | <A class="silver" href="/information">Information</A> | <A class="silver" href="/products">Products</A> </SPAN> <TABLE class="main"> <TR> <TD> <?php include('./1/index.html'); ?> </TD> </TR> </TABLE> <A class="legal" href="/legal">© X 2012</A> </DIV>
-
No problem in error.log and access.log shows it didn't even try to fetch '/1/index.html'.
<?php include('./1/index.html'); ?>
.. is also showing up in the HTML source code via my browser. Is that normal?
-
Here is something that enforces my original thought.
<?php include('./1/index.html'); ?>
When I put this code into its own .php file an run it, it works. So the code is valid. Now to the question, why won't it work inside a table?
-
Please ignore my last two posts.
Ok, where can I check PHP log files?
-
Fuck. hold up shits got messy.
-
When I paste the code outside a HTML table, it works fine.
-
-
At the moment I am creating a search function for my website.
The approach I have in mind is a pseudo-PHP database. To give an example:
A HTML form will submit the results to a PHP file.
HTML FORM - Colour: Black
PHP RESULT PAGE - if ($_POST['color'] == 'Black') {readfile("./products/black/*.html");}
HTML FORM - Price: <$50
PHP RESULT PAGE - if ($_POST['Price'] == '<$50') {readfile("./products/less50/*.html");}
The problem here is if there is an item that is black and costs less than $50, then its going to be listed twice. There is probably some code I can write to ommit the listing of duplicate entries, but it is probably going to be messy, so I am wondering if its better to use a centralized MySQL database, rather than a pseudo-PHP database? I've never used MySQL and don't know much about it and this is my first real attempt at using PHP.
-
Already tried that before mate.
-
Sure,
The root path is:
/var/www/test1.com/
The include\readfile path (the file I want being rendered into the table:
/var/www/test1.com/products/1/index.html
The HTML file in reference that holds the table called "main" we are talking about is:
/var/www/test1.com/products/index.html
-
I assumed the target './1/index.html' would have specified the file location - where "." specifies !!<<from this directory>>!!
I tried your code but it didn't work.
-
That link is 404.
I tried:
<TABLE class="main"> <TR> <TD> <?php include('./1/index.html'); ?> </TD> </TR> </TABLE>
.. but it didn't work.
-
I am wanting HTML to render within a table and sourcing the data from another file. In an attempt to do this, I tried:
<TABLE class="main"> <TR> <TD> <?php readfile('./1/index.html'); ?> </TD> </TR> </TABLE>
This does not work and I am wondering if anyone knows how it can be done - or even if it can be done?
-
My initial line of code was correct. It seems it cannot be output into a HTML TABLE (where this code resides).
-
Could this not be working because this PHP code is embedded into a .html file?
-
Thank you Captain Obvious.
I used:
<?php
include($./1/index.html);
?>
.. but it didn't work.
-
... also tried this:
int readfile ($./1/index.html);
-
I am trying to make PHP output a file in html and using the following code.
<?php readfile("./1/index.html"); ?>
... but it isn't working. How would I get PHP to output a file as HTML?
-
Actually it does work, I typoed.
OK GOOD NIGHT!
-
Thanks for your input dude, but that didn't work.
include() options?
in PHP Coding Help
Posted
A very good suggestion! That sound like a part of the engine I am looking for, but how would I specify which directory to search, and to specify the search to be reclusive, then to include all of those files? Can it be done?
I'll tried this, but it failed: