Jump to content

Portfolio Template


MateThemes
 Share

Recommended Posts

Hello everyone!

I am working with Processwire since some time. But some topics are quite hard for me.

I have a Portfolio (Gallery) Page.

I am build a template with Portfolio Index and pages with portfolio entries.

Structure:

Portfolio Index
-- Portfolio Entry
-- Portfolio Entry

and so on.

Portfolio Entry has an Image field with max 12 images and are accessible Templates. 

Now I want to display the single Portfolio Entry on the Portfolio Index and Paginate them. In the index page all images of a single Entry page should be displayed (I should not be organized as albums, where a random image of the portfolio entry should be displayed). 

I have no clue to achieve this. May someone could give me an advice.

Thank you in advance!

Link to comment
Share on other sites

Hi @MateThemes

I think below is what you mean? This is for the portfolio-index.php.

Pagination is a bit more involved. You could use the inbuilt pager https://processwire.com/docs/front-end/markup-pager-nav/

<?php namespace Processwire;

$entries = $page->children();

foreach ($entries as $entry) {

	echo "<p>{$entry->title}</p>";

	foreach ($entry->images as $image) {

		$imgUrl = $image->width(600)->url;
		echo '<img src="' . $imgUrl '">';

	}
}

 

Link to comment
Share on other sites

On 2/15/2020 at 11:36 AM, Mikie said:

Hi @MateThemes

I think below is what you mean? This is for the portfolio-index.php.

Pagination is a bit more involved. You could use the inbuilt pager https://processwire.com/docs/front-end/markup-pager-nav/


<?php namespace Processwire;

$entries = $page->children();

foreach ($entries as $entry) {

	echo "<p>{$entry->title}</p>";

	foreach ($entry->images as $image) {

		$imgUrl = $image->width(600)->url;
		echo '<img src="' . $imgUrl '">';

	}
}

 

Hello!

Thank you for your help, that gives me a starting point!

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

×
×
  • Create New...