Include page excerps in the album page

Hi guys, I am so glad you built this amazing tool! It is what I have been looking for for such a long time!
I just have a quick question as I am struggling with displaying my pages.
Maybe my question has been asked before, I couldn't find the answer on the forum. I use the ZPArdoise theme and on the Album pages it currently only shows the album thumb and the description.
Is it possible to add page excerpts from zenpage along with these album items? What do I need to add to the album.php? Your help would be much appreciated!
Many thanks!

Comments

  • acrylian Administrator, Developer
    edited December 2017

    The simplest way is to use
    printPageContent('<titlelink of the page>');

    http://docs.zenphoto.org/function-printPageContent.html

    This would print the full page content.

    Since you want an excerpt you would have to use something like
    $pagecontent = getPageContent('<titlelink of the page>'); echo shortenContent($pagecontent);
    http://docs.zenphoto.org/function-getPageContent.html
    http://docs.zenphoto.org/function-shortenContent.html

    You can also use the core object model directly:
    $pageobject = new ZenpagePage('<titlelink of the page>'); echo shortenContent($pageobject->getContent());

  • acrylian Administrator, Developer
    edited December 2017

    Sorry, the example was shortened for better overview. Please review the link to the function documentation I included above which includes the parameters you need to set. Basically you need to set the lenght you want to truncate to and the indicator e.g. "(…)".

  • Thank you, its getting a bit complicated for my amateur coding skills.. ;-) I leave it.

  • acrylian Administrator, Developer
    edited December 2017

    It's really not complicated:
    echo shortenContent($pageobject->getContent(), 100, ' (…));
    100 is the lenght and the last one the shorten indicator. This is really basic PHP stuff you will need always when you like to modify a theme. There is even more sophisticated stuff possible ;-)

  • Thanks!!

  • Ha ha, I guess I need a crash course of php.. Can I challenge you more?
    What if I want to display for a specific album only?

  • acrylian Administrator, Developer
    edited December 2017

    You need to know the album name. That's the name in the url like yourzenphotosite.com/toplevel/sublevel1/sublevel2/….

    Then use
    if($_zp_current_album->name == '<name of the album>') { //do what you want to do }

    This works within the next_album loop on index.php or if the theme has gallery.php, on album.php and search.php. On thte latter it works also on the page itself for thte current album. It also works on image.php for the album of the current image.

    If you want to do this within a php fucntion you need to declare $_zp_current_album global first.

  • Thanks!!!!

  • Thanks!!!! I do need a course ;-)

  • Something like this? <?php if($_zp_current_album->name == 'albumpath') { $pageobject = new ZenpagePage('test'); ?>

  • Thanks, I appreciate it. It's out of my league.. But .. it would be a nice add on in Zenpage if you could select what gallery or album you wish to display a page, and then it shows up as a standard thumb or excerpt so you have everything in one overview, albums and pages. Maybe this is just my need though..

  • acrylian Administrator, Developer

    This is really a specific need. But your example above was actually correct if the album name is "albumpath" and the page name (=titlelink) is "test".

    Maybe you could explain what you actually trying to do or what problem solve? This above only makes sense if the page is somehow related to the album.

  • vincent3569 Member, Translator

    the good question is "what is you need?", because it is not clear for me.

    in back end, you can add a description on each album, with links to other albums, news or page (you have to use tinyMCE plugin and use "ZP" menu link).

    and in news/pages, with the "ZP" menu, you can add album thumb (or a thumb of this album), add the desciption of this album.

  • vincent3569 Member, Translator
    edited December 2017

    and, if you really need to add page content in an album description, I think the best way is to add <?php printCodeblock(1); ?> somewhere in album.php (for example, like that (see line 5 of the file):
    <div class="headline-text"> <?php printAlbumDesc(); ?> <?php printCodeblock(1); ?> </div>

    then you can manage you need by adding html/php code, in the album's Codeblocks.

    with that, you can add something like that, without testing album name:
    <?php $pageobject = new ZenpagePage('<titlelink of the page>'); echo shortenContent($pageobject->getContent()); ?>

  • acrylian Administrator, Developer

    That's a way of course, too! Funny thing is I bascially never use codeblocks myself but rather multiple layouts ;-)

  • vincent3569 Member, Translator
    edited December 2017

    Codeblocks are very usefull!
    With them, I can have these pages:
    http://www.vincentbourganel.fr/pages/portfolio/
    http://www.vincentbourganel.fr/pages/map

    on the two examples, I use dynamic album in a page and I add html/php code in Codeblocks.

  • acrylian Administrator, Developer

    Of course they are and if I am not mistaken it was me who added that feature ;-)

    Just I personally don't really use them nowadays. Both your examples I would probably have done via layouts ;-)

  • vincent3569 Member, Translator

    I use layouts here:
    http://www.vincentbourganel.fr/fetes-des-lumieres-de-lyon/
    this album layout use isotope, and others use standard album page.

    but I am curious: how did you my two pages above with layouts?

  • acrylian Administrator, Developer
    edited December 2017

    I would just create pages with the code you put into the codeblocks. If it's only a few pages you need specific stuff. I find this easier to maintain than codeblocks on the backend. Might be because I often create custom themes for people who really don't know and want to know code. But they can select layouts ;-)
    But if there are more and different things needed I personally might also use codeblocks.

    The flexibility of Zenphoto in this regard allows anyone to use it what it fits his needs best.

  • vincent3569 Member, Translator
    edited December 2017

    OK, I think I undestand how I have to do that:
    I have to create specific pages (called pages_portefolio.php and pages_map.php with my examples) with my specific code included in actual Codeblocks and select these custom pages in my portefolio and map pages.

    never try, but I will have a look.
    my only trouble is to separate "official" php files, managed in github for my themes, and "specific" php files only to suit my needs.
    with my solution, I don't have this problem (my own needs are stored in database of my website ;-) )

  • acrylian Administrator, Developer

    Yes, that's how I might have done it depending what it is for. If codeblocks work for you go with it. There is no real right or wrong here, just several ways to achieve the same.

  • You guys are awesome! I am trying to create a family history site with an album page for each family. I'd like to include some family history as pages in the (family) Album page. I like the way the album page has its simplicity and I want users from one family only to see their family's album and history pages. Also I'm thinking of looking to include a family tree which is in html and with an index page, both are maybe best to do via codeblocks. I think codeblocks might work!!

  • acrylian Administrator, Developer
    edited December 2017

    Okay. One tipp that maybe helps you. You can give the album and the page the same name. So if the album name is "familyx" you can give the page the titlelink (=name) "familyx" as well. That way you can easily "connect" pages and albums. It only works that way if albums are top level as sublevel include all levels (on pages this is not the case).

Sign In or Register to comment.