Jump to content

Image not showing up in tutorial


TDH
 Share

Recommended Posts

Hi,

I'm doing the "But what if I don't know how to code?" tutorial. I'm at the section labeled: Just one image mate. I can't get the image to display. It's showing the small broken image icon instead of my image.

Thanks,

Thuy

Link to comment
Share on other sites

@TDG welcome to the PW forum!

can you post your generating and output code?

(and for reference here is the tutorial page you are referring to).

This is what's in my-first-template-file.php:

<html>
  <head>
    <title>Hello</title>
  </head>
  <body>
    <h1><?=$page->title?></h1>
    <img src=<?php echo $page->my_imagefield->url; ?>  />
  </body>
</html>
 
This is the output of My First Page:
My First Page
{broken image icon goes here}
Edited by LostKobrakai
Please use codeblocks
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

Isn't it that you need single or double quotes?:

<img src='<?php echo $page->my_imagefield->url; ?>' />

or

<img src="<?php echo $page->my_imagefield->url; ?>" />

Edit: it probably doesn't change anything but there are 2 spaces before />. 1 is enough.

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

×
×
  • Create New...