Jump to content

rowlandville

Members
  • Posts

    7
  • Joined

  • Last visited

rowlandville's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have tried your code, other code, variations on the code, and I even think I sort of get how it all works, but nothing seems to see the images in the folder. The images are in http://domain-name/trophy/wp-content/uploads. WordPress is installed in the trophy folder. Any other ideas? I have spent ten hours plus trying to make this work to no avail.
  2. Thanks! Dropping to a simple path got rid of my white screen. Now, $dir is printing to the screen. But $scan[$i] is not. And the fact that $dir is printing only once tells me that $scan is not finding the image and therefore $i isn't incrementing. So I went in and added $_SERVER['HTTP_HOST'] in front of $dir and "/cat-paper-shopping-bags-100-recycled-white-kraft-2.jpg" after, and an image popped up. So the path is correct, yes? So why isn't $scan[$i] finding the images? And thanks for your patience.
  3. Requinix, First, thank you for walking me through this. I need to throw one more curve into this. Between posts, I went searching for more answers. I found a video tutorial. The code he gave was this (and this doesn't even touch on exploding): <?php $dir = 'http://rowlandwilliams.com/trophy/wp-content/uploads/'; $scan = scandir($dir); for ($i=0; $i<count($scan); $i++) { echo $dir; /* I was testing here to see if it would print */ echo $scan[$i]; /* I was testing here to see if it would print */ if (strpos($scan[$i], 'paper') !== false) { echo '<div id="#catalog-directory-images">'; echo '<img src="'.$dir.$scan[$i].'" alt="'.$scan[$i].'" />'; echo '</div>'; } } ?> $dir will print. $scan will not. I kind of feel like with my struggle to understand arrays this would be good to understand. Why am I not getting any sort of value associated with $scan? (I know it isn't your example, but I'm trying to wrap my head around the concept of reading arrays. I think if I can get there, everything else will fall into place.)
  4. I'm extremely weak when it comes to arrays, so please forgive me. So now I have this piece of code: $files = glob($abs_url.$img_path.'/cat-par*.jpg'); foreach $file in $files { $filename = substr($files, strlen($abs_url.$img_path.'/cat-par*.jpg'), 2,4); $pieces = array_map('ucfirst', explode('-', $filename)); } ?> So $files is the variable that contains the, for example, six or eight images in the folder, yes? And then $files is pulled into the foreach statement. There, I want it to read all pieces of the variable contained between the "-" (hyphen) AFTER the first two, "cat" and "par." I know that section is wrong. As for the foreach statement and how values are read into $files: totally lost. The sad thing is that if I had time, I'd go take a PHP course. I love this language, but am often lost within it.
  5. Thanks! I went in and posted this to my page. I got a white screen in response. What did I do wrong? $title = $post_slug; $files = glob("/uploads/cat-{$title}-*.jpg"); for each $file in $files { $filename = substr($files, strlen("/uploads/cat-{$title}-"), -4); $pieces = array_map("ucfirst", explode("-", $filename)); }
  6. I have been getting my rear kicked on this. I want to: 1. Read directory called "uploads" for files "cat-[thispage]-[filename].jpg". 2. If file begins with "cat" and [thispage] matches the page slug of this current (WordPress) page, print image to screen. 3. Extract [filename] and split is components (which are separated by hypens) into discrete words. 4. Print discrete words (first letter capitalized) under image. 5. Provide hyperlink to page [filename]. While I'm not a great coder, I think I can do step 1 and probably 2 (although most of you would laugh at the coding). But i really need help exploding the content and then using that data. Any help would be appreciated. Thanks.
  7. Okay. I am trying to create a form with 7 simple select options and an 8th dual select option. You can see it here: http://rowlandwilliams.com/seize/test.php The idea is that a user can choose any of the 8 options and the total price associated with that selection will populate the box at the top left of the page. The user can also decide to choose a different option than they previously selected. In that case (if they first selected option #2 and changed their mind and chose #5 next), the default value "Please Select" will replace their initial value at option #2. Everything seems to be working fine, except that the option #8 doesn't work at all. I know that's because #8 has two aspects to it, but it has to have that. Any help will be welcome help, since I am a true novice and confused as hell. Thanks.
×
×
  • 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.