/    Sign up×
Community /Pin to ProfileBookmark

Product page urls

On the subject of having CSS to php code, say if I were to make an Product page with lots of products, and say for example

Product image url: /productimage/1.gif
would that mean I put that url into a variable and that variable was $image1 and on the HTML document which is on the same document.. I put in
<img src=”$image1″> or something like that? And then I could style it?

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@temp_user123Jul 06.2007 — Styling it would not be based up the url. Styling is either inline, using the [B]style[/B] attribute, or you use the [B]class[/B] attribute. PHP can be used to set either. However, using style classes is supposed to make your page smaller (downloads to the browser faster) and easier to maintain.

<img src="<?=$image[1]?>" class="<?=$class[1]?>">
Copy linkTweet thisAlerts:
@DragonkaiauthorJul 06.2007 — So your saying, when I put in a gif image of a product into a variable of $image1 I can use that variable in the HTML document like this:

<img src="<?=$image[1]?>"

But I don't see why the class has to be like class="<?=$class[1]?>"> Couldn't I just say class="productpictures"? Unless You're talking about making the classes dynamic so for different products there's different styles?

Are you talking about that?
Copy linkTweet thisAlerts:
@temp_user123Jul 06.2007 — Yes. Any of the HTML attribute values may be made dynamic and filled in by the PHP shortcut shown.

[B]<?=?>[/B] is a shortcut for the [B]echo[/B] statement.
Copy linkTweet thisAlerts:
@DragonkaiauthorJul 06.2007 — That's was what I was looking for thnks.
×

Success!

Help @Dragonkai spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...