Jump to content

kennywhite

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kennywhite's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I want to make the news feed on my website easier to maintain. I just created a form that I will use to add the information. The form saves the files that it creates as "entry-date-time.txt" and places it in a folder for the year and a sub folder for the month. Such as "2011\09". I have displayed data from a single flat file before, but I am unsure how to go about displaying the data from multiple files. Can anyone show me an example? I want to be able to paginate the data, displaying a number of updates per page from newest to oldest. I don't have MySQL access on the server or I'd just use that, instead.
  2. Thanks. I'll be sure to remember that in the future.
  3. For the time being I added this runtime setting to not display notices. error_reporting(E_ALL & ~E_NOTICE);
  4. Thanks for the tip. I did change my includes to a php extension. I just took my site from my local test server and put it live. Now I get this error on the live page: Notice: Undefined index: x in /home/punkrock/public_html/index.php on line 50 I get this if I go to index.php, but the else statement works, because the "else" include does shows up. If I go to index.php?x=cat:1 I don't get the notice and the includes still show up as expected. Is there something wrong with the way the code is written? The first line below is line 50, by the way. # GRAB THE VARIABLES FROM THE URL $x = $_GET['x']; $valid = array('cat:1', 'cat:2', 'cat:3', 'cat:4', 'cat:5', 'cat:6', 'cat:7', 'cat:8', 'cat:9', 'cat:10', 'cat:11'); if(in_array($x, $valid)) { $trimmed = ltrim($x, "cat:"); include_once 'includes/' . $trimmed . '.php'; } else { include 'includes/1.php'; }
  5. Awesome! Thanks! I should have remembered the brackets, but I was totally clueless to ltrim. Thanks again!
  6. I'm more or less a noob. I have used the below code on another webpage, but on a new site that I am working on I attempted to trim the variable and now the page won't load. Can someone show me what I did wrong or a better way to accomplish this? <?php # GRAB THE VARIABLES FROM THE URL $x = $_GET['x']; $valid = array('cat:1', 'cat:2', 'cat:3', 'cat:4', 'cat:5', 'cat:6', 'cat:7', 'cat:8', 'cat:9', 'cat:10', 'cat:11'); if(in_array($x, $valid)) $trimmed = trim($x, "cat:"); include_once $trimmed . '.inc'; else include '1.inc'; ?> When I used this before my variables did not have a colon in them, so I did not have to trim the variable, thus the last part of the script was: if(in_array($x, $valid)) include_once $x . '.inc'; else include('1.inc'); ?>
×
×
  • 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.