Jump to content

What this single line Code does and how pass its value in a PHP Variable?


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

Archived

This topic is now archived and is closed to further replies.

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