Jump to content

proggR

Members
  • Posts

    431
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://sourced.fm

Profile Information

  • Gender
    Male
  • Location
    Ontario Canada

proggR's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Can I have my name changed from hopelessX to proggR. I use proggR for everything else online and hopelessX is just a silly name.
  2. What saw? I've heard this with a mirror and that part is "look in the mirror and see what you saw". Clever play on words
  3. how did you get there? I want to make a room escape game but I'm having a problem coming up with a reasonable scenario why you'd be stuck in a room. Its always been the downfall of the genre to me.
  4. [quote author=cgm225 link=topic=106377.msg934794#msg934794 date=1215689782] I hate when people surround their username with X's, like XXXcgm225XXX    what is with that? [/quote] what about one X  :( lol its better than just being hopeless
  5. Sorry I posted that wrong. It should have been ($i=1;$i<=$max;$i++). $max would just hold the number of pages that I need to use. But I've never had it work. Not even if I've replaced it with a numerical value instead.
  6. Oh, duh. Thanks! Is there any reason why arrays in php don't seem to play nice with a normal for loop? In C/Java I know I'd be able to access them this way. Apples and oranges obviously, just wondering if theres a reason or if maybe I was just having bad luck. Thank you a lot though. I'll make the changes tonight and see how it works out.
  7. Thank you teynon. That was really helpful to learn.
  8. Ya I was actually just reading that. I'm not sure if this will work for me for what I need. The first index represents a page number and the second index represents the post on that page. I'll need to access them independantly from eachother. What I want to happen is when I'm on page 3 it will go to the third element in the first index (the index that holds the page number) and I will be able to loop through each post index within that. So: //page 3 for($i=1;$i<=1;$i++){ include($post[3][$i].".php"); } is essentially what I want to do. $post holds the filename of each post and I'll be including them 5 at a time onto a page. I'm not sure how I could use the foreach for that. I was kind of hoping to be able to access them more like this if possible.
  9. yah thats what i've seen before. could someone explain the logic of it? i'm not sure I fully understand that.
  10. Is there any way to access each individual array element individually with something as simple as a loop? I'm actually using a two dimensional array created with array_chunk($input, 5); From there I want to have one loop for the first index and a second embedded loop for the second index So I want: for ($i = 0;$i<=$max;$i++){ for ($j = 0;$j<=5;$j++){ echo $array[$i][$j]; } } but when I do that it just prints array[1], array[2] etc. Any help? I've read some about for ($var as $varname) or something like that but forget. can i just use a simple loop like i have? Thanks in advance. I haven't worked on this for a while so I thought I'd ask.
  11. Mine was because I'm kind of a hopeless romantic and nothing seemed to be working in that department for me so I decided I'm not the one who's hopeless, romance itself is hopeless and so I used to post everywhere as hopelessXromance. But then I got too lazy to type it all and cut it to hopelessX. Its more fitting now since it includes all aspects of my life :P And Pee Ess. I've been with my girlfriend for almost a year and it seems to be going good still (knock on virtual wood) so maybe I'm not hopeless afterall! :P
  12. That's perfect Sasa! Thank you so much.
  13. 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.
  14. 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.