2

I have to insert full path to every single image/css file of my website, because of url_rewriting and I'm looking for the most officiant way to do it.

Of course I could do:

<img src='<?php echo $full_path; ?>/images/theImg.jpg' alt='alternative text' />

But somewhere I saw people doing it like this, or something:

<img src='{full_path}/images/theImg.jpg' />

Now do you know how the second example is possible, or is it just part of some framework and can't be used in normal document?

Thanks for answers,

Mike

18
  • In this very case you don't need any variable full path. /images/theImg.jpg is all right. Commented Jun 6, 2010 at 16:39
  • Not if you mod_rewrite the adrress for something like shop.com/product/product-name and want the img from shop.com/images/img.jpg and not shop.com/product/images/img.jpg Commented Jun 6, 2010 at 16:41
  • Just try it. /images/theImg.jpg works for the shop.com/product/product-name as well as for the every page on the site. It is called absolute path and the only solution for the filenames. Commented Jun 6, 2010 at 16:46
  • the first code example is absolutely fine Btw, you can just use ../images Commented Jun 6, 2010 at 16:46
  • @Col. Shrapnel: Depends on the mod_rewrite rules. Relatives paths are considered relative to the rewritten address. Commented Jun 6, 2010 at 16:49

2 Answers 2

2

It is just part of some framework and can't be used in normal document.

Sign up to request clarification or add additional context in comments.

Comments

1

And if it's not a full framework, perhaps it's just a templating engine like Smarty http://www.smarty.net/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.