echo page type

Permalink 1 user found helpful
Hello!
I've got some problem - I need to chceck what is the page type of my page. I need to have something like this:

if (/*current page is default page type*/)
{
echo 'Yes';
}


I need this because i have display some content based on page type and I don't wont to make another page type.

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi tzmudzinski,

What version of concrete5 are you using?

If 5.7, there is:
getPageTypeHandle()
getPageTypeID()
getPageTypeName()
http://www.concrete5.org/api/class-Concrete.Core.Page.Page.html...
tzmudzinski replied on at Permalink Reply
Hey!
I'm using Concrete5.7.
I have probably problem with implementation of this function. Can you give an advise?
MrKDilkington replied on at Permalink Best Answer Reply
MrKDilkington
Here is an example of their use.
$c = Page::getCurrentPage();
$c->getPageTypeID();
$c->getPageTypeHandle();
$c->getPageTypeName();

Example:
if ($c->getPageTypeName() == 'Empty Page') {
    // do this
}
tzmudzinski replied on at Permalink Reply
I've try to do in this way.
But nothing happens.
MrKDilkington replied on at Permalink Reply
MrKDilkington
Can you include more details of what you are doing.
tzmudzinski replied on at Permalink Reply
I manage this!
The problem was that I used getPageTypeName instead of getPageTypeHandle!
Now everything works perfect!
Thank you very much for your help!