Jump to content

error while getting file url


Sylvio
 Share

Recommended Posts

Hello,

I have this simple code that throws errors

I put in an echo (to test) of the url call on the file (line 5), it throws:

/voetvolk.be/site/assets/files/1016/grande_guide_to_lead_nurturing.pdf

"Notice: Trying to get property of non-object in ......."

Weird thing, the path is outputed as you can see, but I'm getting these errors

The $snippet->press_date and $snippet->title are showing up, no problem here

The file field press_snippet is a single file field.

<?php
$press = $pages->get("/press/")->find("press_project=$page->id");
echo "<h3>Press</h3>";
echo "<table>";
foreach($press as $snippet) {
echo $snippet->press_snippet->url;
?>
<tr>
<td><a href='<?=$snippet->press_snippet->url?>' target='_blank'><img src='<?php echo $config->urls->templates?>img/<?=$snippet->press_snippet->ext?>_icon.png' alt='<?=$snippet->press_snippet->get('description|name')?>' title='<?=$snippet->press_snippet->get('description|name')?>' width='24' height='31'/></a></td>
<td><?=$snippet->press_date?><br/><?=$snippet->title?></td>
</tr>
<?php
}
echo "</table>";
?>

It's probably someting stupid, but I'm not seeing it

Thanks

S.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...