Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display group page with children two levels deep? #38

Open
alkazar1957 opened this issue Feb 9, 2017 · 9 comments
Open

Display group page with children two levels deep? #38

alkazar1957 opened this issue Feb 9, 2017 · 9 comments

Comments

@alkazar1957
Copy link

Is there a way to return the content of a page which is at least two levels deep in a group of pages?
e.g. Blog > Sub-blog > Sub-Sub-blog > content

Cheers.

Ken.

@chadanuk
Copy link
Contributor

chadanuk commented Feb 9, 2017

We've not tried this before!

You may find some issues with URLS but I've just tried it by adding {!! PageBuilder::category() !!} to a the page.blade.php view in the "posts" category on the coaster2016 theme. and it seemed to work ok!

You may want to specifiy a view ['view' => 'category_view_name'] (and folder structure categoryies/[view_name]/page.blade.php,pages_wrap.blade.php which just displays the content you need. But it looks like it should work!

@alkazar1957
Copy link
Author

Does work but I guess I had better explain a bit better.
I have group pages of say
Awards:
Team One:
Sales;
Content Pages
AfterSales:
Content Pages
Team Two:
Sales;
Content Pages
AfterSales:
Content Pages
I need to display:
Team One Team Two
Sales Aftersales Sales After sales
Page 1 Page 1 Page 1 Page 1
Page 2 Page 2 Page 2 Page 2
Page 3 Page 3 Page 3 Page 3
Page 4 Page 4 Page 4 Page 4

In my template if I hard code the page_id e.g.

{!! PageBuilder::category(['page_id' => 15, 'view' => PageBuilder::block('category_view'), 'limit' => 4]) !!}
{!! PageBuilder::category(['page_id' => 15, 'view' => PageBuilder::block('category_view'), 'limit' => 4]) !!}

I can get the listing of Team One (haven't got as far as trying Team two yet) but this requires the hard
coding of the page_id. Is there a way to get the sub page_id in the template? Tried in the page.blade.php. Hmm that was fun!

Cheers.

Ken.

@alkazar1957
Copy link
Author

Ah crud that second pagebuilder page_id should have been 17. copy paste copy paste......

Ken.

@chadanuk
Copy link
Contributor

chadanuk commented Feb 9, 2017

OK, I see the issue (sort of!)

In page.blade.php you shouldn't need to get the page ID (you can) But I can see that's not really what you need.

If you pass through render => false into a category, you'll get an array of the pages back. That you could then manipulate?

That could get you somewhere?

If not you could just render out a list of page Ids in a sub-category view that you can then pass all the way back to the template.

@alkazar1957
Copy link
Author

Hmm passing render => false returns nothing. Nadda. Zip.
{{ PageBuilder::category(['page_id' => Pagebuilder::page_id(),'view' => PageBuilder::block('category_view'), 'render' => 'false']) }}
This is in my template.blade.php is this the correct place and syntax?

Thanks for your time btw.

Ken.

@chadanuk
Copy link
Contributor

chadanuk commented Feb 9, 2017

No problems,

Have you tried:
@php $subPages = PageBuilder::category(['page_id' => Pagebuilder::page_id(),'view' => PageBuilder::block('category_view'), 'render' => 'false']); @endphp

?

@alkazar1957
Copy link
Author

Yes and it returns the links to the sub-categories but no access to the pages that belong to the sub-categories.

Ken.

@chadanuk
Copy link
Contributor

chadanuk commented Feb 9, 2017

Yeah, that makes sense. But then you can loop through those pages and use further category views to get the data from the lower levels in the template.

@alkazar1957
Copy link
Author

Sorry just been taken off that project for a more urgent one. I should be back at this in the next week or two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants