Jump to content

Recommended Posts

Posted

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

Posted

@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).

Posted (edited)

@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
  • 2 weeks later...
Posted

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.

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