Jump to content
roelof

pagination and frontpage question

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

It's the famous "how to do this" question.

Share this post


Link to post
Share on other sites

Last question before I can really can begin with building.

Can I somehow check if a page is the front/home page.

I need there another css file then all the other pages.

Roelof

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Another way, assuming that you have a 'home' template:

if ($page->template == 'home') echo 'Yeah baby, on the homepage!';

Share this post


Link to post
Share on other sites

Hello,

I have a fixed text which will be only visible on the front/home page.

Can I better leave this in the template file or can I better use a custom field for it.

Roelof

Share this post


Link to post
Share on other sites

I think I have read somewhere in the forums people say if it is fixed and won't change, why waste PHP resources? Stick it in the template file :). Up to you ultimately...

  • Like 1

Share this post


Link to post
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?

Share this post


Link to post
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


 

Share this post


Link to post
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..

Share this post


Link to post
Share on other sites

Im interested in the manner which the theme is build.

But if there a easier or better way to build it Im in.

This is my first build in PW so Im looking for a good way to build a site.

Share this post


Link to post
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..)

Share this post


Link to post
Share on other sites

Oke, I can try that. Can I install the profile and the Pw files both with git or does that give problems.

Roelof

Share this post


Link to post
Share on other sites

You can fork it in Git to your computer (very easy if you are on windows) - or just download it and install normally..

Share this post


Link to post
Share on other sites

Did all the steps exactly as described but no skyscrapers site only 500 error or the old backend.


I think I give up on PW sadly.

Roelof

Share this post


Link to post
Share on other sites

Sorry it didn't work out for you. Maybe, take a break from it. If you decide to come back to it, start by reading up on the docs, take small steps, complete the simple site tutorial....ease into it...

Share this post


Link to post
Share on other sites

I did all the steps and im also sorry that it did not work for me.

I still think the last problem is more a theming problem then that I do not understand how PW works,

Roelof

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...