Jump to content

Recommended Posts

Friends,

 

    $this->aws["template"] = str_replace("%%Title%%", $this->aws["Title"], $this->aws["template"]);

 

This is from my Amazon store API script, what does this code do?

 

All i know is, i can use %%Title%% in my HTML template to output the Title.

 

But i want to input this Title to a PHP variable, reason is, Title name has spaces, and i want to replace those spaces with "+", to make a SEO URl.

 

- What does this code do?

- How to pass the %%Title%% value to a PHP variable like, $title

 

Can someone help?

 

Thanks all

Natty

It helps to understand the function str_replace.

$title = $this->aws["Title"];

In the link you can see how the str_replace function actually works

How Can i pass the Value of %%Title%%,  to a PHP Vairbale?

From reading how the str_replace function works you will see that the first arguement is the search param which means it will search for %%Title%% and will replace it with the replacement.

 

$this->aws["Title"]

This is actually your title and not %%title%%

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

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.