Comment » Exploring EE Custom Weblog Fields and Pagination
I’ve done a bit more work on my Library and Portfolio sections today. This time I focused on custom weblog fields and explored different ways of handling pagination.
Custom weblog fields
For the library section I decided to change the look of the thumbnail page slightly, and add a review page for each book. This is the first time I experimented with the custom weblog field option, which is really neat. I think I finally understand the whole “EE is whatever you want it to be” now. Out of the box it is suited best for a blog site, which is why I guess it gets sometimes gets stuck in this category.
Just think of custom weblog fields as separate storage areas for your content.
Out of the box EE comes with three default weblog fields: summary, body, and extended text. An example of the way this would be set up on a blog site would be that there would be two templates: a homepage template, and an article template. The teaser (summary) for an entry appears on the homepage. This entry has a link on the bottom, such as “Read More” or “Complete Article”, which when clicked takes you to the full article. The full article page, in the article template, would have the body text, and perhaps the extended text. (The extended text could contain something like photos for the article.) Again, any content you somehow want sectioned off can be assigned a custom field.
Setting up a library with custom weblog fields
For my particular situation, I organized the library section with five custom fields: Book Cover, Buy Link, Author, Review, and ISBN. I also had two main templates for my library section: the index page (thumbnails of my books) and the individual review page. On my index page, I arranged my books as thumbnails with the only the book cover weblog field displayed. When either a title or book cover is clicked, it brings the reader to the review page for that particular title (which uses the review template). In my review template, I call all of my custom weblog fields: the book cover, author, ISBN, buy link, and review text. Each has their own CSS style(s) for formatting.
I would definitely recommend that anyone read more about custom fields before they start building a site with EE. It makes organizing the data on your site much easier. I found the EE documentation for this section wasn’t very helpful in showing practical application, but searching the forums reveals some very creative ways people have used custom fields.
Creating Gallery Pagination
The major renovations on my portfolio section were adding pagination links and fixing the category lookup. (Now, when a category link is clicked, thumbnails of the section are shown instead of the category page listing.)
With pagination, there’s two methods to consider: using the paginate tag, and Next/Previous entry linking.
Here’s the difference: the paginate tag is for when you have a bunch of entries generated, and only want to display a certain number at any given time. It defines a cutoff point for the amount of entries. Next/Previous entry linking is for linking to the previous and next entries relative to one specific entry. (This is applicable to comments as well.)
I made the mistake of trying to use the paginate tag as the navigation for my portfolio, and then wondered why I had such weird results. I needed to use Next/Previous entry linking instead.
Since Next/Previous entry linking is independent, you should define the weblog you want to link to. (In my case I added the weblog="portfolio" parameter to the tag so that only entries from my portfolio weblog would be linked.)
Reading the two user documents I have linked to above should answer most questions about how to use the pagination and Next/Previous entry linking methods.
