Jump to content

fivedots

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Everything posted by fivedots

  1. Thanks for the reply! I ended up taking a simpler route and disregarding my desire for the array to still be represented from left to right. Since I'm dealing with images, I have a little bit of leeway. Ended up just doing this, which is working so far: <?php // populate array with numbers 1 to 27 (odd to test new column logic $total = range(1,27); // divide the total number of items in the array by the desired number of columns $per_column = count($total) / 4; // open up the initial row + columns echo '<div class="row">'; echo '<div class="span3">'; $i = 0; foreach ($total as $value) { $i++; echo '<img src="http://placehold.it/300x400">'; // check to see if we're at the total of items needed for this column and move to next column if so if ($i >= $per_column) { $i = 0; echo '</div>'; echo '<div class="span3">'; } } // close the final column and row echo '</div>'; echo '</div>'; ?>
  2. Okay, let's simplify to considering an array whose desired output is a 2x2 grid. Say the array contains: Apples, Oranges, Plums, Pears. Using the proposed solution, we'd output: Apples, Oranges Plums, Pears What I need to output is: Apples, Plums Oranges, Pears Which I will arrange into columns using something like: <div class="column"> Apples Plums </div> <div class="column"> Oranges Pears </div> So I want to output the data by column rather than by row. Unfortunately can't think of how else to explain it at the moment.
  3. That I can do, the issue is that I need to output each complete column at a time instead of outputting R1C1, R1C2, etc. Need R1C1, R2C1, etc. while maintaining the appearance of having done it the way you explained, i.e. in the same/original order. The reason being I'm outputting thumbnails of various heights and want the column contents to stack properly without the row taking the height of the tallest item. Does that explain it a bit better?
  4. Trying to do something that I think should be very simple. Let's assume that I have an array populated with the numbers 1 to 24 for this example. I need to output these items in 4 columns to accomodate my CSS layout but still have them read from left to right, top to bottom. I also want this to be somewhat dynamic - I'm okay hardcoding it to split into 4 columns, but need it to handle any number of items in the array. I'm not sure if the best way to do this would be to split the original array into an array for each of the 4 columns, or to loop through the original array 4 times and output items 1+4, 2+4, and so on. Or maybe I should be using array_filter with some custom callback functions. I'm fine with any solution. The end result is echoing the array in the following groupings so I can surround each column with the appropriate column HTML for layout (in this case the array actually contains IMG urls): Column 1: 1, 5, 9, 13, 17, 21 Column 2: 2, 6, 10, 14, 18, 22 Column 3: 3, 7, 11, 15, 19, 23 Column 4: 4, 8, 12, 16, 20, 24 Any help would be appreciated! This one is driving me nuts and I know it should be relatively easier. Guess I should stick to HTML + CSS.
  5. Hi! Having a lot of fun dusting off the coding and putting together a site with PHP, CSS, and jQuery. I've run into one problem that I can't get past though. I implemented jQuery History to use hashtags to maintain browser back/forward buttons and linkability of the site (and not reload header and footer when updating content). The main purpose of the site is to showcase photography that's hosted on Flickr. I've got this working well using Slickr. I have the Slickr code to load my galleries sets in a file called 'pictures.php' which is loaded fine into #page_content using a link to #pictures. The problem arises when I click on a gallery/set: I get taken back to the default view of the site without any hashtage because Slickr requires a link using parameters, so: www.myexamplesite.com/#pictures becomes www.myexamplesite.com/index.php?id=72157626067797650&p=1 As you can see, since it loses the hashtag, I am no longer looking at the right page. Does anybody have any ideas on how I can specify both the hashtag and the parameter? Cheers!
×
×
  • 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.