Hi. I am working on a theme which displays always the same layout: an image, plus a menu of albums linked to their latest image. My index.php changes context and includes image.php:
`
set_context(ZP_GALLERY);
$_zp_current_album = $_zp_gallery->getAlbum(0);
add_context(ZP_ALBUM);
$_zp_current_image = $_zp_current_album->getImage(0);
add_context(ZP_IMAGE);
include ('image.php');
`
The whole thing holds together, and comments are displayed properly for the current image, whether the user is on index.php or image.php (after any click).
The problemWhen under an image.php URL, comments for current image are viewed and posted correctly.
When in index.php, comments for current image are viewed correctly, but none posted and no error message is echoed.
Tests
Problem does not seem to be $_zp_current_context. I get a puzzling 6 (ZP_GALLERY + ZP_ALBUM) in index.php after image.php is included (how can that be after I force the context change?), but even if I force it to 7 in image.php for debugging, checking before and after printCommentForm that the value remains, comments are not sent from index.php.
Comments just vanish, as they don't appear either in admin panel (thinking they might be getting attached to albums instead of images).
- I've checked all global variables I could find in comment_form.php, out of desperation and lack of knowledge, and they output the same value in index.php and in image.php.
I've tried both checked and unchecked "allow comments in albums". No difference.
Adding
`
header('Location: ' . FULLWEBPATH . '/' . getURL($_zp_current_image));
`
to index.php solves the problem, but having the user reach a subpage on arrival to the site is unacceptable.
My assumption is that "pushbutton" uses the url to link the comments to the proper object, and zenPhoto discards them as Gallery is not a valid comment-containing-object. However all of this, tests and assumption, has been playing above my current knowledge, and I'm stuck not knowing what to try next or how to get more info. I would try to get in the middle of the form's "#" action if I did know or could find what it means, but I don't and I couldn't.
Anyone can give me a clue?
Comments
Hi. I am working on a theme which displays always the same layout: an image, plus a menu of albums linked to their latest image. My index.php changes context and includes image.php:
`
set_context(ZP_GALLERY);
$_zp_current_album = $_zp_gallery->getAlbum(0);
add_context(ZP_ALBUM);
$_zp_current_image = $_zp_current_album->getImage(0);
add_context(ZP_IMAGE);
include ('image.php');
`
The whole thing holds together, and comments are displayed properly for the current image, whether the user is on index.php or image.php (after any click).
The problem
When under an image.php URL, comments for current image are viewed and posted correctly.
When in index.php, comments for current image are viewed correctly, but none posted and no error message is echoed.
Tests
- I've checked all global variables I could find in comment_form.php, out of desperation and lack of knowledge, and they output the same value in index.php and in image.php.
My assumption is that "pushbutton" uses the url to link the comments to the proper object, and zenPhoto discards them as Gallery is not a valid comment-containing-object. However all of this, tests and assumption, has been playing above my current knowledge, and I'm stuck not knowing what to try next or how to get more info. I would try to get in the middle of the form's "#" action if I did know or could find what it means, but I don't and I couldn't.Problem does not seem to be $_zp_current_context. I get a puzzling 6 (ZP_GALLERY + ZP_ALBUM) in index.php after image.php is included (how can that be after I force the context change?), but even if I force it to 7 in image.php for debugging, checking before and after printCommentForm that the value remains, comments are not sent from index.php.
Comments just vanish, as they don't appear either in admin panel (thinking they might be getting attached to albums instead of images).
I've tried both checked and unchecked "allow comments in albums". No difference.
Adding
`
header('Location: ' . FULLWEBPATH . '/' . getURL($_zp_current_image));
`
to index.php solves the problem, but having the user reach a subpage on arrival to the site is unacceptable.
Anyone can give me a clue?
I suggest to read the theming tutorial and the object model tutorial.
I don't really understand what you are trying to do and why do you include image.php at all? You can do all this with the normal theme way much more easily letting Zenphoto do all the context stuff...
I read both the theme and object model tutorial right at the beginning, and have been reading more tuts as more issues to solve came across. I've also gotten pretty used to the function list, though obviously my real knowledge of it is not great.
I started by doing the index.php, with the idea of using the same code for album.php and image.php afterwards, and kept working on it until I got stuck. I think -but I am not sure- it was comments that weren't properly displayed in index.php for the image shown, or maybe even a problem displaying the latest image and its info, and could only find the solution with the change of context. Before that, I didn't even know what context was.
I will give your suggestion a go again, with more understanding, and post the deadpoint, if there is any.
You can do more sophisicated things if you have more decent (PHP)programming knowledge - there is no actual limit except your abilities.
I also suggest to look at default theme included in the release. Especially the first is a pretty standard theme. The other three are a little more sophisticated although the Zenpage theme might be worth a look if you want use the CMS functionality of the Zenpage CMS plugin. Efferscene+ and Stopdesign are quite complicated themes and really nothing for starters codewise.