RewriteRule for sorting out gallery and news

Hi

How can I use RewriteRule to get something like /index.php?gallery and /index.php?news so that it only shows the albums and the other link only shows the news?

Best regards

Comments

  • acrylian Administrator, Developer
    No, you can't because Zenphoto does not generate such links. You would have to hack the core which we of course do not recommend. You can do that of course if you really want but you will be on your own with that.

    What is actually wrong with our links like `/zenphoto/news` etc???
  • The problem is that it then shows both albums and news. This is because I have CombiNews on I assume(?) And if I turn of CombiNews I wont get a index page that shows both news and albums. My goal is to have a index which shows both albums and news, a gallery link that only shows albums and a news link that only shows news.

    Any suggestions on how to go on solving that? Thank you for your answers.
  • acrylian Administrator, Developer
    You can disable the "news on index" option of zenpage-default to get the normal gallery index as the start page. Then you can reach the news page by `zenphoto/news` (or the all news link on the category menu). This is not dependend on the CombiNews option.
  • How do i disable "news on index"? And how do I show both gallery and news on the same page?
  • Ops! I found it. Blind there for a minute.
  • Is it maybe possible to edit the include in index.php to return zenpage_zp_index_news but not for /page/gallery? Something like index.php?p=gallery&news for example. Or put include ('gallery.php', setOptionDefault('zenpage_zp_index_news', true)); or something like that on index.php
  • What I am trying is to get index with "combinews" (albums and news), gallery without "news on index" (only albums) and news without "combinews" (news without albums). Is that possible?
  • acrylian Administrator, Developer
    I am not sure if I do understand correctly. by standard Zenphoto as a gallery index pages listing hte top level albums and Zenpage has a kind of news index (the "all news" page). You can of course modify your theme to have both on one page but the problem is they use the same procedure for the pagination so you will get funny results.

    Therefore it is recommended to have them separated. You can disable the news on index to get the normal gallery index page. You can of course still have the CombiNews enabled for the news page.
    Sorry you can have only one news and gallery page unless you want to do some more scripting as you will have to work with the object framework then. All internals are setup for the standard news pages.

    You can also use the printLatestNews function to print x news exceprts on the index page (It is also capable of showing "combinews"). Maybe that is what you are after and a little easier?
  • Is it possible to wrap <?php printLatestNews(4, "none", "none", true, true, 70, true); ?> into the code that shows all the albums?

    <div id="albums">
    <?php while (next_album()): ?>
    <div class="album">
    <div class="thumb"> " title="<?php echo gettext('View album:'); ?> <?php echo getBareAlbumTitle();?>"><?php printCustomAlbumThumbImage(getBareAlbumTitle(), NULL, 95, 95, 95, 95); ?> </div>
    <div class="albumdesc">
    <h3>" title="<?php echo gettext('View album:'); ?> <?php echo getBareAlbumTitle();?>"><?php printAlbumTitle(); ?></h3>
    <?php printAlbumDate(""); ?>
    <p><?php echo truncate_string(getAlbumDesc(), 45); ?></p>
    </div>
    </div>
    <?php endwhile; ?>
    </div>
  • acrylian Administrator, Developer
    How do you mean, within the albums? No, that function prints an unordered list of its own, but you can use it on the same page of course. (btw "none" is not really a parameter value).
  • I mean with the album excerpts that are shown on gallery.php. (I copied gallery and points index to gallery1.php) I am thinking on using the same css classes so news are shown in neat small lightblue boxes too. Here is my index: http://trondheimkunsthall.com/temp/ I am not too good in explaining:-P

    What do you mean with not a value? It says "string $option: "none" for only news articles " in the documentation (http://www.zenphoto.org/documentation/plugins/zenpage/_plugins---zenpage---zenpage-template-functions.php.html)
  • acrylian Administrator, Developer
    1. Ok, I think I understand. I guess in that case you need to change the news page css layout to get that as boxes. I think it is not possible to mix the albums index and the news that way without a lot of serious extra coding.

    2. Sorry, I was mistaken with the parameter, I did not remember correctly (we have the documentation also for ourselves..;-)).
  • I read in the documentation:

    News on index.php
    This option allows to turn the theme index.php into the first page of the news section (all further ones will be displayed on news.php). All you have to do to use this is to copy the complete next_news() loop to your index.php.

    But I can't get it to work. I've tried to put the code below div id="content" and other places:

    `
    <?php while (next_news()): ;?>

    <?php printNewsTitleLink(); ?><?php echo " <span class='newstype'>[tekster]"; ?>

    <?php printNewsDate();?> | <?php echo gettext("Comments:"); ?> <?php echo getCommentCount(); ?> |
    <?php
    if(is_GalleryNewsType()) {
    if(!is_NewsType("album")) {
    echo gettext("Album:")."<a href='".getNewsAlbumURL()."' title='".getBareNewsAlbumTitle()."'> ".getNewsAlbumTitle()."";
    } else {
    echo "
    ";
    }
    } else {
    printNewsCategories(", ",gettext("Categories: "),"newscategories");
    }
    ?>
    `
  • acrylian Administrator, Developer
    The zenpage-default theme is already setup for this.
  • Mhm I see that the code are already in gallery.php, but how do I go about printing news before the albums?
  • acrylian Administrator, Developer
    By placing the next_news loop where you want it. I have not tried that because as I said you will get funny results with the pagination.
  • <rant>I hate the name of this thread. It addresses a possible solution to a problem instead of the problem itself, thus it was hard to find </rant>. I would suggest an alternate title similar to: "Dynamically controlling Combinews." However the thread covers the content I am interested in so I will not create a new thread. There is another thread that also touches on this topic from a different angle: "Recent images in news feed?"

    The OP presented their (and my) real problem in their 2nd post:
    My goal is to have a index which shows both albums and news, a gallery link that only shows albums and a news link that only shows news.
    They were not trying to generate more than one gallery.php, news.php, or index.php.

    After a discussion and confusion, the basic answer was: it can't be done without hacking the core code.

    Restating the problem and my thoughts on it:

    I am writing a custom theme. It will have a custom menu and a breadcrumb.

    I want my theme home page (index.php) to show a list of links to the latest news articles and latest updated albums mixed together and sorted by update time. I want Previous and Next page links for this main index as well. A next_news() loop with Combinews turned on does that just fine.

    The theme custom menu will have a link for "Just Albums". That link will take you to gallery.php. That page is easily done using a next_album() loop.

    The theme custom menu will have a link for "Just News Articles". That link will take you to news.php. That page is also easily done using a next_news() loop with combinews turned off.

    What I think I want is the ability to toggle combinews on and off as desired in the theme code.

    I started to try this but discovered that ` ZP_COMBINEWS ` is a constant and I don't have to time to hack though all the core code to test my theory right now. In addition, I suspect that making ` ZP_COMBINEWS ` into a global ` $_ZP_COMBINEWS ` would have a lot of unintended consequences. (I just looked a little deeper and there may not be that many unintended results after all...)

    As an alternative, maybe an optional parameter on next_news() like parameter 2 on getLatestNews()

    I do not want to write installation specific core code updates (hacks).

    As my interim solution, based on a hint from acrylian, I tried turning combinews off and using `getLatestNews(10,'with_latestupdated_albums')` to return the 10 latest news and album changes. That seems to work as far as I have pursued it. That surprised me a lot because I expected that function to be controlled by combinews (which was turned off) but I still got album and article results mixed together. I do not want to use this approach because I will have to do a lot of theme code to display the attributes of the items and it will not support any kind of paging.

    I apologize for rambling, but after restating the problem a little differently, does anybody have any suggestions on how to approach the problem?
  • OK, I left out out an obvious detail.
    Instead of changing ZP_COMBINEWS from a constant to a global, add a new global $zp_combinews and have the appropriate core code use the global instead of the constant. That way, default behavior can be maintained/restored as needed.
  • acrylian Administrator, Developer
    getLatestNews is not controlled by Combinews as that depends on the parameter set (it does use combinews as you told it to).

    There is indeed no convenient way to disable combinews for the news loop temporarily. But you can always build anything using the object model directly. Another workaround is to attach a category like "news" to all articles and call that category to get articles only.

    Anyway for such things you probably should open a ticket.
  • Yeah, I had considered that but it means that I have to remember to do something special for every article I publish. My breadcrumb logic needs to be smarter as well. Overall though, it may work out better that the non-paging index approach.

    thanks
Sign In or Register to comment.