Open PHP result in a php echo code
-
Hello,
guys you are so fantastic. Maybe you know a solution for this problem…
I am using the following code to read out the meta field named “GalleryID”.
<?php function meta_galleryid() { global $id, $post_meta_cache; if ( $keys = get_post_custom_keys() ) { foreach ( $keys as $key ) { $values = array_map('trim', get_post_custom_values($key)); $value = implode($values,', '); if ( $key == 'GalleryID' ) { echo "$value"; } } } } ?>
This works fine. The result is for example “1” or “2” if I enter these numbers in the meta field.
I am using the NextGEN Gallery and by using the code <?php echo nggshowgallery(1,450,450); ?> the gallery with the ID 1 opens. I want to connect now this NEXTGen-Function with the display of the meta galleryID.
I thought that the following code will work:
... if ( $key == 'GalleryID' ) { echo "<?php echo nggshowgallery($value,450,450); ?>"; ...
But it do not work… Also this do not work:
<?php echo nggshowgallery(<?php meta_galleryid(); ?>,450,450); ?>
Why not? What would be the solution? Is there any possibility to open a php within a php??
Thanks for your help guys
Jen
- The topic ‘Open PHP result in a php echo code’ is closed to new replies.