Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Print image url of category x and y as variables?


smask

Recommended Posts

Hello!

 

I was wondering if anyone happens to know if there are some convenient way to

print the urls of the categorie's images as variables?

 

example:

url of the image of category1 printed as $variable1

url of the image of category2 printed as $variable2

 

And while I'm at it, i also wonder if it's possible to print the url image of product image x as a variable?

 

Thanks in advance & for reading!

Link to comment
Share on other sites

Solved it myself.

 

echo $product_info['products_image']

 

prints the url of product image

 

and

 

$imageurls .= $row['categories_image'] . ' ' ;

 

// from php.net

// split a string into an array of space-delimited tokens, taking double-quoted strings into account

function tokenizeQuoted($string)

{

for($tokens=array(), $nextToken=strtok($string, ' '); $nextToken!==false; $nextToken=strtok(' '))

{

if($nextToken{0}=='"')

$nextToken = $nextToken{strlen($nextToken)-1}=='"' ?

substr($nextToken, 1, -1) : substr($nextToken, 1) . ' ' . strtok('"');

$tokens[] = $nextToken;

}

return $tokens;

}

 

$tokens = tokenizeQuoted($imageurls);

 

outputs the categories image urls as $tokens[0], $tokens[1], $tokens[2] etc

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...