GetSimple Support Forum
have a problem with get_theme_url() - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: have a problem with get_theme_url() (/showthread.php?tid=703)



have a problem with get_theme_url() - Alessio_roma - 2010-05-13

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?


have a problem with get_theme_url() - n00dles101 - 2010-05-13

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.


have a problem with get_theme_url() - Alessio_roma - 2010-05-14

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...


have a problem with get_theme_url() - Carlos - 2010-05-14

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


have a problem with get_theme_url() - Zegnåt - 2010-05-14

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


have a problem with get_theme_url() - Alessio_roma - 2010-05-14

thank you very much,now it works!