marcus Posted January 24, 2013 Share Posted January 24, 2013 Hi, sorry to bother you again -- I'll try not to open topics/asking questions daily The following codes does not work properly and I'm wondering why: <?php $download1 = $pages->get(1014)->download1;?> <a href="<?= $download1->url?>"> <img src="<?php echo $config->urls->templates?>images/pdf.png" /> </a> Ressource 1014 has the field "download1" filled with a dummy pdf, and the URL is printed. But nothing more, ->file, ->filename, ->name, ->ext and so on are empty although the file (dummy_1.pdf) can "physically" be found in /site/assets/files/1014/ Have I missunderstood the Cheat sheet/API in some way? Thanks again! marcus Edit: this code is placed in another template, therefore the $pages->get(1014) instead of $page->download1 Link to comment Share on other sites More sharing options...
Khan Posted January 24, 2013 Share Posted January 24, 2013 Try this: <?php $download1 = $pages->get(1014)->download1->first();?> 2 Link to comment Share on other sites More sharing options...
marcus Posted January 24, 2013 Author Share Posted January 24, 2013 *facepalm* I stepped in the ->first()-trap again... From now on I'll place a post it on my monitor, stating "...have you tried ->first?" or "Try ->first() first before annoying people in the PW forums!" Thanks! 1 Link to comment Share on other sites More sharing options...
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