Hi,
I have a situation where I link an album (artist) to their page (bio). So the common identifiers are $_zp_current_album->getFolder() and the page titlelink. So on the artist album and image pages, I can call the bio information from a page with:
`
<?php if (getPageContent($_zp_current_album->getFolder())) {
printPageContent($_zp_current_album->getFolder());
} else { ?>
Their is no Bio page set up for this artist yet, please contact us to set one up.
<?php } ?>
`
This may not be the best way to do it, I am not sure, but my issue is when the client creates a new album (artist), without also creating the corresponding bio page, if the album is browsed, an empty page with the title link is created. I would have thought the getPageContent() would have returned false.
Tried to follow the linkage of this function:
`
function ZenpagePage($titlelink, $allowCreate=NULL) {
$new = parent::PersistentObject('pages', array('titlelink'=>$titlelink), NULL, true, empty($titlelink), $allowCreate);
}
`
to the persistent object, etc and came across the $allowCreate variable but cannot seem to set this to false so that an empty page is not created.
Hope this makes sense, any suggestions much appreciated, especially if you have an idea for a better way to accomplish this.
Cheers!
Comments
You could workaround this by using the `getPages()` Zenpage class method and do a simple loop to check if the page actually exists.
`
$pages = $_zp_zenpage->getPages(); // for backward compatibility this currently still returns all fields not just the titlelink
foreach($pages as $page) {
if($_zp_current_album->name == $page['titlelink']) {
...
}
}
`
Again, thanks for your help -
In your case you will have to explicitlycheck for existence as the `printPageContent()` presumes the page exists.