Jump to content

Reference to an image placed within the site template from an img tag


uzlander
 Share

Recommended Posts

Hi everyone! I admit it sounds a bit silly, but i can't do simply <img src="<?=$config->images_path.'pw3.png';?>" alt='pw-logo'>
($config->images_path i've defined in my config.php, it points correct). On the page it shows alt text though. What am i missing ? 😞

pw_issue_faq.png

Link to comment
Share on other sites

The "correct output" you are showing is an absolute file path. On websites in the <img> tag you need an url relative to your site's root folder. That would typically be something like /site/templates/img/foo.jpg

Not sure why your path shows "site-news" instead of just "site" though.

Link to comment
Share on other sites

Yeah, seems like i need to refresh my knowledge on php fundamentals, much thankful for rapid help !:)
Corrected:
<img src="<?=$config->images_url.'logo.png';?>" alt="">
with corresponding line in config.php: $config->images_url = $config->urls->templates.'images/';

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...