[SOLVED] Get a single page or post

Post Reply
User avatar
Fred
Legend Bludit
Posts: 236
Joined: Wed Jun 24, 2015 2:14 pm
Location: France
Contact:

Hi Diego and Bludit Community,

For a new theme, i make a function to get a single page.
But Bludit have a tip to get without function a page or post?
My function:

Code: Select all

    /**
     * Get a page with slug
     *
	 * @param  name, title
	 *
	 * @return  name, title
     */	
	function getPage($name, $title=false)
	{
		global $Page, $pagesParents;
		
		foreach($pagesParents as $parentKey=>$pageList)
		{
			foreach($pageList as $Page)
			{
				if ($Page->slug()!=$name)
					echo 'No page to display!';
				else if ($Page->slug()==$name && $title)
					echo '<h1>' .$Page->title(). '</h1>' .$Page->contentRaw(true);
				else 
					echo $Page->contentRaw(true);
				break;			
			}
		}
	}
With this, is easy to make single page theme ;)
Last edited by Fred on Sun Apr 17, 2016 7:00 pm, edited 2 times in total.
╰☆╮Bludit╰☆╮ is a open source and community contributions are essential to project success!
You are looking for a light forum based Json? Try my project Flatboard, it is free. ;)
Sorry for my little english, i'm french :oops:
User avatar
abdulhalim
Master Bludit
Posts: 128
Joined: Thu Mar 10, 2016 6:25 pm
Location: Bandar Abbas
Been thanked: 4 times
Contact:

Is it something like landing page ? any demo please
User avatar
Fred
Legend Bludit
Posts: 236
Joined: Wed Jun 24, 2015 2:14 pm
Location: France
Contact:

Yes Landing page template.

For the moment i have just screenshots => here <=.

I make a page and publish in draft for don't display in the menu, work great but i wait Diego confirmation for integrate this tip in natively on Bludit.
╰☆╮Bludit╰☆╮ is a open source and community contributions are essential to project success!
You are looking for a light forum based Json? Try my project Flatboard, it is free. ;)
Sorry for my little english, i'm french :oops:
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

Hi Fred,
you can check this file bl-kernel/boot/rules/71.pages.php <--- here the pages are created

You have an array $pages with all pages object, you can make an vardump to check the array structure.

Code: Select all

var_dump( $pages );
and if you want to get a particular page you can call the function buildPage();

Code: Select all

$Page = buildPage( $slug );
echo $Page->title();
User avatar
Fred
Legend Bludit
Posts: 236
Joined: Wed Jun 24, 2015 2:14 pm
Location: France
Contact:

Hi Diego!
I was sure you had planned it on Bludit but impossible to see where :lol:
So I see this theme out here can even more easily.
Thank you ;)
╰☆╮Bludit╰☆╮ is a open source and community contributions are essential to project success!
You are looking for a light forum based Json? Try my project Flatboard, it is free. ;)
Sorry for my little english, i'm french :oops:
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

It's my bad, my poor documentation.
If you need more help about themes tell me.

Diego
Post Reply