• jorgent

    (@jorgent)


    Hi.

    I really hope someone can help me with this. I’m using a weather script to display the weather in my header.php. It’s not a plugin, so I use php include to get the script. Everything is working perfectly except the weather icons. I don’t know how to get the correct path to the img folder.

    The blog is not online, so I don’t have a link yet, but maybe this will help:

    To get the script to work, I’ve modified these paths in the weather script.

    Default (not working):

    //Required files
    require "../lib/yrFetch.class.php";
    require "../lib/yrLayout.class.php";

    Modified (working):

    //Required files
    require (TEMPLATEPATH . '/easyYr02/lib/yrFetch.class.php');
    require (TEMPLATEPATH . '/easyYr02/lib/yrLayout.class.php');

    But this doesn’t work with the images. The code is different:

    Default:

    // Create new layout class and set image directory
    $yr_layout = new yrLayout();
    $yr_layout->imgDir="../img/";

    I’ve tried this:

    // Create new layout class and set image directory
    $yr_layout = new yrLayout();
    $yr_layout->imgDir=(TEMPLATEPATH . '/easyYr02/img/');

    But the path to the img folder gets totally messed up.

    As you can see, my php skills are rock bottom. I don’t know if these code snippets will help to see the problem. I only need to get the correct path to the img folder. It’s located in my theme folder ( themes/themename/easyYr02(script folder)/img/imagefiles.png )

    Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jorgent

    (@jorgent)

    Hmm, maybe the problem is more complex than it seems. Any php gurus here who knows what’s wrong with this? (I’ll guess it’s a syntax error):

    $yr_layout->imgDir=(TEMPLATEPATH . '/easyYr02/img/');

    Cheers!

    Thread Starter jorgent

    (@jorgent)

    Forgive me for bumping this thread, but the timesheet for this project is starting to run out.

    I can’t help think the problem is easily spotted by someone with good php skills. Maybe I’m not explaining the problem good enough, but I don’t know since I don’t get any replies 😉

    Cheers!

    Thread Starter jorgent

    (@jorgent)

    I’ve fixed the problem by using absolute url and not a relative path.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Need help to get the correct path’ is closed to new replies.