GetSimple Support Forum

Full Version: have a problem with get_theme_url()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a problem with this function in a php guestbook,when i use get_theme_url in the form action (html) the function work correctly but when i use this in php code for receive guestbook.txt directory ($dirfile=get_theme_url()."/guestbook.txt"; ) it doesn't work beacause it prints the url.How i can resolve?
functions beginning with "get_" will echo the result, "return_" functions will return to a variable...

however there is none for theme_url

you could just use

Code:
$dirfile=$SITEURL . "theme/" . $TEMPLATE."/guestbook.txt";

Mike.
Thank you but there is another problem,if i try to echo $dirfile the file url is ok but when i use the function file_exsists($dirfile) it returns false.Why?If i paste the url of $dirfile on my browser,i should be it...
You could use the constant GSTHEMESPATH:

Mike's example would then be:
Code:
$dirfile=GSTHEMESPATH.$TEMPLATE."/guestbook.txt";

However I would rather store it in the data/other path:
Code:
$dirfile=GSDATAOTHERPATH."/guestbook.txt";

List of GetSimple constants here: http://get-simple.info/docs/plugin-creation
Alessio_roma Wrote:When i use the function file_exsists($dirfile) it returns false. Why?
Because file_exists() needs a path to the file on the server, the browser need the URL where it can retrieve the file. The constants Carlos mention are paths on the server, something like "/public_html/data/other/", and $SITEURL as mentioned by Mike will return something like “http://example.ms/”.

I hope you understand the difference Smile
thank you very much,now it works!