Forum

Thread tagged as: Question, Problem, Feathers

How do i display an image on a master template

Hello,

Creating my first Perch site. So pretty new to this. I was wondering how i place images on a master page and have the URL correct on all pages?

i have a master page called inner.php and i want to use it as a top level page, Second level and Third level page. But if i change the URL to match the top level, it doesnt work second and third level.

I am using Quill feather for my CSS and Javascript put i cant seem to create an image one.

my code for that is

    public function get_tel_icon($opts, $index, $count)
    {   
        $out = array();


        $out[] = $this->_single_tag('img', array(
                    'src'=>'/fireplace/images/phone-icon.svg',
                ));


        return implode("\n\t", $out)."\n";
    }
ltjfan site

ltjfan site 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

To make your path work regardless of the position in the site, use a root-relative path, starting with a slash.

doesn't work for me as i have the perch folder as level 3 on my host as its a dev server, for now i will use <base> tag as it hasn't brought up any issues for me yet. once i move the site to the correct server in which it will sit when its live, i will switch it back.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that would be an option. It might be worth looking at how your dev server is set up to avoid problems occurring when moving from dev to live.