Jump to content

pagination and frontpage question


roelof
 Share

Recommended Posts

Hello,

I have this structure

dagboek

----- 2005

-------- january

-------  februari

------2006

------january

------februari

And now the client wants to start with januari 2005 and when the last article is displayed the next article displayed is the one of january 2006.

Is this possible in PW ?

Roelof

Link to comment
Share on other sites

Roelof,

I do not mean to be rude. I would really love to help you but am finding it rather difficult at the moment for three reasons. One, you have started interrelated threads and posts in various places and I just can't keep up. Second, I am not sure how comfortable you are with PHP and PW. Stating this can be helpful so that people responding to your questions don't make assumptions. Third, I think it would be appreciated if your questions were more specific. Take for instance your question above are you talking about pagination? Are you talking about a menu? Or are you talking about listing latest articles? What exactly does the client want to do? What have you tried? How did it go? Again, I don't mean to be rude but I think you will get better answers if you heed to these simple suggestions:

1. Please try and post in one thread before opening another

2. Please be more specific with your questions.

i am not a moderator in these forums so this is just plain advice from one newbie to another. I mean no offence; I only wish to see you get the answers you need. Building sites in PW should be enjoyable, not frustrating and I wish that your experience with the system is enjoyable. Thanks for reading.

Cheers/k

  • Like 1
Link to comment
Share on other sites

Hello,

Oke, Im talking about pagination. Im building a sort of journal with this idea ( 20thingsIearned.com)

I have tried nothing yet. I know I can use $page-> next to get the next article of a month but I try to figure out when that is a Nullpage how I can goto the next parent of that year.

For example if the last article of let's say january is displayed the first article of februari is displayed when the user pressed next.

Roelof

Link to comment
Share on other sites

You can do something like this:

echo "The next article is:";

$id = 0;
//check if there's this month next article
if ($id = $page->next->id);

//check if there's next month article
elseif  (count($page->parent->next->children)) {
    $id = $page->parent->next->children->first()->id;    
}

//heck if there's next year article
elseif (count($page->parent->parent->next->children)) {    
    if (count($page->parent->parent->next->children->first()->children)) {
        $id = $page->parent->parent->next->children->first()->children->first()->id;
    }    
}

if (!$id) echo "This is the end my friend.";
else {
    $p = $pages->get($id);
    echo "<br /><a href='{$p->url}'>{$p->title}</a>";
}

You have to put this code in your article template. It suggests that you don't have month pages without articles.

Kongondo is totally right that you have to be comfortable with PHP, HTML, CSS at least at the beginner's level to enjoy the benefits of ProcessWire. ProcessWire propels experimentation and creativity so you could go ahead and modify the code for finding previous articles as your homework ;)

  • Like 2
Link to comment
Share on other sites

@roelof: you might also want to check out this thread: http://processwire.com/talk/topic/3714-how-to-do-this/. Unless I'm misinterpreting something here it's essentially the same question.

By the way: when starting new discussions, you really should try to include something about your question in the thread name itself. It's difficult to find related discussions when they're named like "How to do this", "How can I do this" etc. Just another friendly forum tip.. :)

  • Like 1
Link to comment
Share on other sites

if ($page->id==1) {echo "you are on the home page"};// if the ID of this page is 1, then it is the homepage 

OR

if(!$page->parent->id) echo "You are on the homepage";//Means, if this page has no parent, then it must be the homepage 

Actually, there is a lot of useful information in the documentation: http://processwire.com/api/variables/page/. It's worth having a look at ;)

  • Like 2
Link to comment
Share on other sites

Turn debug on (in dev site only) or check in /site/assets/logs/errors.txt. What messages do you get? Have you checked your paths are correct? In Firebug or other web console, what errors do you see? Did you follow all the instructions listed here?

I couldn't see anything in your link above; I mean, I don't know what am supposed to be looking at. Link to site maybe?

Link to comment
Share on other sites

Link to the site : http://test.tamarawobben.nl

I could turn on debug but as I said I also cannot log into the back end with a 500 error message

Roelof

Edit 1 : and I see this error messages on error.txt :

2013-06-19 
10:09:50    guest    http://test.tamarawobben.nl/dagboek/login/    Error: 
    Exception: Template file does not exist: 
'/home/vhosting/c/vhost0008707/domains/tamarawobben.nl/htdocs/test/site/templates/admin.php' 
(in 
/home/vhosting/c/vhost0008707/domains/tamarawobben.nl/htdocs/test/wire/core/TemplateFile.php 
line 67)

2013-06-19 
10:49:59    guest    http://test.tamarawobben.nl/http404/    Error: 
    Exception: Template file does not exist: 
'/home/vhosting/c/vhost0008707/domains/tamarawobben.nl/htdocs/test/site/templates/basic-page.php' 
(in 
/home/vhosting/c/vhost0008707/domains/tamarawobben.nl/htdocs/test/wire/core/TemplateFile.php 
line 67)

2013-06-19 
10:50:02    guest    http://test.tamarawobben.nl/http404/    Error: 
    Exception: Template file does not exist: 
'/home/vhosting/c/vhost0008707/domains/tamarawobben.nl/htdocs/test/site/templates/basic-page.php' 
(in 
/home/vhosting/c/vhost0008707/domains/tamarawobben.nl/htdocs/test/wire/core/TemplateFile.php 
line 67)

2013-06-19 
10:50:13    guest    http://test.tamarawobben.nl/http404/    Error: 
    Exception: Template file does not exist: 
'/home/vhosting/c/vhost0008707/domains/tamarawobben.nl/htdocs/test/site/templates/basic-page.php' 
(in 
/home/vhosting/c/vhost0008707/domains/tamarawobben.nl/htdocs/test/wire/core/TemplateFile.php 
line 67)

2013-06-19 
10:50:13    guest    http://test.tamarawobben.nl/http404/    Error: 
    Exception: Template file does not exist: 
'/home/vhosting/c/vhost0008707/domains/tamarawobben.nl/htdocs/test/site/templates/basic-page.php' 
(in 
/home/vhosting/c/vhost0008707/domains/tamarawobben.nl/htdocs/test/wire/core/TemplateFile.php 
line 67)
 

Which are right. I deleted all the those templates.

Roelof


 

Link to comment
Share on other sites

There you go. Is it the whole functionality of the Skyscrapers profile that you are interested in or is it the theme itself (html and css)? If the former, then install the profile as per the instructions then edit it in small chunks, testing along the way that you haven't broken anything. If the latter, then you can grab that from the "view source" in your web browser or by grabbing what you want from the template files..

Link to comment
Share on other sites

Then, maybe do as I have suggested. Install it as per instructions, then edit it in small chunks and testing as you go along.

Btw, ideally, I think, you should try to develop your sites locally (WAMP, XAMPP, etc..)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...