rooofl Posted August 2, 2013 Posted August 2, 2013 Hello, beginner here. First, Processwire is amazing. I try it from yesterday and already made so much progress! A field allow me to unzip an archive in assets/. Now I would like to include in my template a stylesheet.css extracted from the archive. I think I meet some permission issue because nothing is included. Can you confirm and help me? $fontlist = $pages->get("/fonts/"); foreach($fontlist->children as $child){ $stylesheet = $child->webfont_archive->url.'stylesheet.css'; echo "<a href='".$stylesheet."'>".$stylesheet."</a>"; // This link is ok include($stylesheet); // Nothing here }
adrian Posted August 2, 2013 Posted August 2, 2013 Welcome to PW! Try using "->path" instead of "->url" as you need the full path to the file on the server when using include. That said, do you really want to "include" the stylesheet? Do you simply want: <link rel="stylesheet" href="'.$stylesheet.'" type="text/css">
rooofl Posted August 3, 2013 Author Posted August 3, 2013 Thank you Adrian for your answer. My issue is solved, Indeed I don't want to include directly the stylesheet. Can you precise the difference between path and url? And what I should use path for an include?
adrian Posted August 3, 2013 Posted August 3, 2013 Glad you got it working. Have you seen the API cheatsheet? http://cheatsheet.processwire.com/ path vs url is explained there for use in both $page-> and also $file-> Your best way to really figure some of this stuff out is to echo the results to the page. echo 'url: ' . $child->webfont_archive->url . '<br />path: ' . $child->webfont_archive->path; That way you can see exactly what is being returned. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now