, Guest!
Already a Member? Login or Register.

Menu



Showcase


Due to the volume of spam happening on our forums, posting is now restricted to verified members only.  If you're not verified, drop us a note with your username.

Home > FlexCMS Support Forum > User Help > General Support Requests > References using relative paths in scripts

FlexCMS Support Forum


References using relative paths in scripts
Started April 7, 2006 @ 11:11am by rvdc2005
Post Message 
rvdc2005


Posts: 17
 
References using relative paths in scriptsApril 7, 2006 @ 11:11am
I'm using JavaScript to display random images. In the script, I refer to the image files using relative paths, so something like "images_random/image01.jpg".

I would think this refers to the FlexCMS URL plus the image path. On the home page, this is indeed the case and the image file is displayed correctly. However, on all other pages, 'index.php' is added to the URL, and the image reference is broken. Is there an easy way around this?

Would it be better if I did this in PHP? (That's not a big deal, I just had a JS script ready to use.) Does the .$BaseURL. variable take this into account, or would I run into the same thing?

Thanks
Ron
 
DCSun
Administrator



Posts: 625
 
April 7, 2006 @ 11:31am
Ron,

Yes, you'll need to connect it to the FlexCMS paths in some way. The easiest is to use PHP and reference the variables FlexCMS makes available for you.

Here are a few of the variables available that you may find useful:

$BaseURL - base location of the site, such as "http://www.flexcms.com"

$ImagesURL - base location for images (as specified in the Site Settings section), such as "http://www.flexcms.com/images"

$TemplateImagesURL - path to the template folder currently in use (useful if you wish to use menu images, for example, and have them change when the template is changed), such as "http://www.flexcms.com/templates/template_name"


Hope that helps. Feel free to paste the code in here if you're still having problems getting it working.


David


FlexCMS v3.2 Has Been Released!
 

Post Message 




Try & Buy FeedForAll - Easy to use RSS Feed Creator - great for iTunes users!

MEMBERS




All Contents, Code, Scripts and Technologies Copyright 2003-2009 FlexCMS.
All Rights Reserved. Software License Agreement

Processing Time: 0.08585 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS