Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter azezer

    (@azezer)

    I finally saw the error, i forgot a = after src at the image.

    The code works =) sweet.

    Now to implement the Timtumb into this to, but thats another story.

    Thanks for help stvwlf.

    Tread solved

    //Azezer

    Thread Starter azezer

    (@azezer)

    Now i continued a bit and got this far:

    <?php
    $products = get_post_meta($post->ID, "product", false); 
    
    if ($products[0]=="") { ?>
    
    <!-- If there are no custom fields, show nothing -->
    
    <?php } else { ?>
    
    <div class="produktbeskrivning">
    	<h3>Products</h3>
    
    <?php foreach($products as $product) {
    
    $temp = explode("&", "$product");
      $descrip = $temp[0];
      $price = $temp[1];
      $img = $temp[2];
    
    echo '<div class="grid">'.$descrip.'&nbsp;&nbsp;&nbsp;'.$price.'&nbsp;&nbsp;&nbsp;<img src"'.$img.'" /></div>'; } ?>
    
    </div>
    
    <?php } ?>

    But i cant get the image to show.

    I print this in custom field product:

    Product&299:-&http://xxxxxx.com/wp-content/uploads/image.jpg

    Do i miss something so that the server gets that it is a image to fetch?

    Azezer

    Thread Starter azezer

    (@azezer)

    I think i can use something like this:
    "<img src='" . $img . "' />"

    to implemate in this:

    <?php
    $products = get_post_meta($post->ID, "product", false); 
    
    if ($products[0]=="") { ?>
    
    <!-- If there are no custom fields, show nothing -->
    
    <?php } else { ?>
    
    <div class="produktbeskrivning">
    	<h3>Products</h3>
    
    <?php foreach($products as $product) {
    
    $temp = explode("&", "$product");
      $descrip = $temp[0];
      $price = $temp[1];
      $img = $temp[2];
    
    echo '<div class="grid">'.$descrip.'&nbsp;&nbsp;&nbsp;'.$price.'</div>'; } ?>
    
    </div>
    
    <?php } ?>

    Ive tried to put in in after $price, but it gave me error ” blank page “.

    search continues

    Thread Starter azezer

    (@azezer)

    Thanks stvwlf.

    works like a charm, found som minor errors in the code like, { instead of [ at the temp variable.

    foreach($products as $product // why do we say, $products as $product ?
    Is it so that $ products is a multiple value and we want to declare that we can use it as $product several times?

    Now i want to implement a <img> above each Product.

    Will try to do this when i get home from work, maybe i can manage that myself.

    Azezer

    Thread Starter azezer

    (@azezer)

    Anybody who has a tip where i can read about this and more?

    Azezer

    Thread Starter azezer

    (@azezer)

    Thank u!

    Now i got a output of that seccond_value.

    But still only if i have a true statement of that value.

    I guess that a need to do that foreach statement for the seccond value as well, but how do i combine theese two, or three … for that matter.

    <?php foreach($description as $description) // how to add $seccond_value here?

    Another question that popped up is if i can combine two $values if i always wants the to be together.

    Like description and price.

    $description
      $price

    I mean to save code space and only declare thoose two one time, nd then have 1 combined vale like $product ?.

Viewing 6 replies - 1 through 6 (of 6 total)