Jump to content

Using relative image path in field (solved)


ryanC
 Share

Recommended Posts


Hi, I’m building a simple Processwire test site. I am coding the pages with traditional HTML and CSS on my desktop, and then entering my HTML content into Processwire fields as a last step. The idea is to have a functioning static desktop version that works independent of any CMS. My php knowledge is very limited right now, but I am trying to learn.

I have my Processwire templates and fields set up just the way I want, my question is regarding the path I have for my images. Right now, in Processwire, the field I enter my HTML content has this as an image path:

<img src=“/siteName/site/templates/images/photograph.jpg" />

That works, but I would like it to be:

img src="images/photograph.jpg"/>

This way I could still have a functioning page independent of Processwire. Is this possible?  Can I tell Processwire to ignore all those other levels of folders and just accept "images/photo"?

Thanks!

Link to comment
Share on other sites

Looks like I found the answer here on the forums:

So now my path has:

 

   <base href="<?= $config->urls->templates ?>" />

in the header section, and from there I can simply type "images/photo.jpg" in my field.

  • Like 1
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...