Jump to content

proggR

Members
  • Posts

    431
  • Joined

  • Last visited

    Never

Posts posted by proggR

  1. Anyone know the exact step by step that happens when you print. I know the document gets send to the spooler. I know the printer reads the spooler and prints the document by telling the printheads what to print where. Anyone want to go into more detail about what happens and how. Just curious and wanted to know more about it but I haven't been able to find any docs as of yet.

  2. Well since the first index is for the page number i can then use that number from a link (like if the person clicks "page 3") and feed the value 3 to another script that will pull up the five posts within $post[3]. That would basically just be a loop that would look like:

     

    for ($i=1;$i<=5;$i++){

    include("$post[3][$i];);

    }

     

    It would obviously need some formatting so that they're aligned vertically but that's beside the point.

    The files that I'm reading in are all formatted html files saved as .php so when I include them it already has all the content and its just being pasted into the page. This allows me to use the same data if someone wants to view that post individually or for when I have it setup by keyword (course subject). That's all been worked out, if I can get the array to work.

    I'm pretty sure its still two dimensional since it only has two indexes. Its like a chart where the rows represent page number and the columns are the post on the page and the value in the chart is the url that I'm trying to assign to it. Its like a DB without a DB I guess.

    I haven't really setup my arrays. I'm not sure how to declare them. I'm used to arrays in Java, and to a lesser extent, C. Basically all I would need to do is:

    String array[][] = new String [100][10]; *the numbers are the largest index it can handle*

    Although I may be wrong for declaring String array but thats generally the way.

    Anyway. I just need to know how to declare a 2d numerical array and how I can assign values to it using loops, similar to the way i did in the OP.

  3. Two Dimensional Arrays in PHP seem to be confusing me and I'm not sure where I'm going wrong.

    Basically what I want to do is have a two dimensional array hold the filename of a blog post (I'm scripting a basic blog engine in case you were wondering). The posts are all in a folder as an individual .php file that will be include()d into the blog page. Each page will have 5 posts on it. I've scripted counting the number of files in the folder and read each of the filenames into a normal array. I've got it so it knows how many pages there will be based on the 5 posts per page. The only thing I can't figure out is the 2d array.

    The first index of the array will be the page number and the second index will be the post number on that page so essentially what I'm trying to do is:

     

    $counter = 1;

    for($i=1;$1<=$numpages;$i++){

         for($j=1;$j<=5;$j++){

              $post[j]=$fileURL[$counter];

              $counter++;

         }

    }

     

    I don't fully understand arrays in PHP so I just wrote it the way I'm used to declaring them. If someone could modify this to be a working example it would be great. I'm sure I can work through the logic if I see a working example of what I'm doing.

    As of right now it seems to be my only stumbling block. Also, is it necessary to use foreach() to read the values or could a normal for() loop handle it?

    Thanks in advance for any help.

     

     

    *edit* there is no database or anything like that either. I just have the files saved into a folder and will be reading them in from there. I may change to a DB later but for now its just a flat file system (except not the normal flat PHP file systems that I've seen in other blog engines because I didn't like the way they were setup)

×
×
  • 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.