Jump to content

Easiest Way to Include Assets in a top-level directory


ruzel
 Share

Recommended Posts

I'm building my first brand new Processwire site! It's easy and looks really extensible so I'm excited. However, I have a codeigniter app that is going to eventually sit in a directory beneath Processwire and I want to store assets like css, js, and images in a top-level directory that both CI and PW will access.  Right now, I've accomplish this by using tags like

`<img src="<?php echo $config->urls->templates ?>../../assets/images/russellbits-logo-small.png" alt="Russellbits"/>`

Works fine, but it's messy.  Is there another way I could do this in PW without making an http call?

Link to comment
Share on other sites

Ah! Easy-breezy. For anyone looking for an answer to this, there is a variable in the $config->urls for root!  So the above image tag can look like this:

 <img src="<?php echo $config->urls->root ?>assets/images/russellbits-logo-small.png" alt="Russellbits"/>

Nice.

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