Page 1 of 1
is there a way to get the URL where is the revlet ?
Posted: Thu Nov 19, 2009 5:52 pm
by dme69
Hello all,
I want to load some text files in a revlet to populate some menus. This files will allways be at the same place as the revlet.
I know it's possible to find the path to stack inside the IDE but how to do it for the web ?
I'm not sure I'm clear.
I hope someone will understand what I mean and I promise to make some efforts to speak a better english
Thanks.
Dominique.
Re: is there a way to get the URL where is the revlet ?
Posted: Thu Nov 19, 2009 8:33 pm
by SparkOut
Yes it's possible but you have to use the fully qualified URL.
dme69 wrote:This files will allways be at the same place as the revlet.
is perfectly understandable, but at the risk of being accused of being deliberately awkward, it's not, strictly speaking, the actual case.
The files are in the same place as the place (the url) from which the revlet is being
served. The
actual presence of the revlet is running in the browser
on the client's computer so to refer to a local path relative to the revlet you are talking about somewhere on the client side. To get the revlet to refer to the location of the text file on the server, you need to use the fully qualified domain url (eg
http://www.mydomain.com/myfiles/myfile.txt). That may result in permission issues, etc. so be careful.
Posted: Fri Nov 20, 2009 3:41 pm
by Mark
Hi Dominique,
There are so many ways to do this. If you don't want to include a static URL in your scripts, you might include the URL in the embedding HTML code and get the data from the revletParams property/array.
Example:
Code: Select all
<!-- Embed your revlets using code like this, to automatically guide the user to install the plugin, if it is not already installed -->
<div id="plugin" style="display:none">
<object classid="CLSID:BHJ9JHB-BHJM-87R1-NHB7-MNBG53AJ9B" width=330 height=219>
<param name="src" value="MyRevlet.revlet"/>
<param name="stack" value="Untitled 1"/>
<param name="requestedName" value=""/>
<param name="instanceID" value=""/>
<embed type="application/x-revolution"
src="MyRevlet.revlet"
width=200 height=200
stack="Untitled 1"
requestedName=""
instanceID=""
locationUrl="http://www.domain.com/path/"
></embed>
</object>
</div>
<div id="noplugin" style="display:none">
<a href="http://revweb.runrev.com"><img src="http://www.runrev.com/revweb/images/revweb-noplugin.gif" border=0></a>
</div>
<!-- Revlet embedding code finishes above this line -->
I have added
Code: Select all
locationUrl="http://www.domain.com/path/"
manually. You can obtain the data in the following way:
Code: Select all
put the revletParams into myArray
put myArray["locationUrl"] into myUrl
You might use javascript to write the locationUrl dynamically. For example:
and you might even do this inside your revlet:
Code: Select all
do "document.location.href;" in browser
put the result into myUrl
Best,
Mark
Re: is there a way to get the URL where is the revlet ?
Posted: Mon Nov 23, 2009 2:24 pm
by dme69
Thank you very much for your precious help.
Dominique.