Jump to content

Code for Page name in Custom Block


Action_Builder

Recommended Posts

What is the code I will need in order to display the page title that I entered when I created the page within Pages?
I have tried the following and nothing shows up. What am I doing wrong. I have other PHP code working within the block.

{{echo '$page->$title';}}
{{echo "$page->_title";}}
{{echo '$page->title';}}

 

Link to comment
Share on other sites

I have been playing with this also and I came up to this:

<h3 class='ipsWidget_title ipsType_reset'>Custom Title</h3>

You can also create a language phrase and insert it instead of Custom Title

<h3 class='ipsType_reset ipsWidget_title'>{lang="custom_title"}</h3>

You can create language phrases in your lang.php file of your theme.

To find that file you need to set first Designer's Mode from ACP theme settings to have that file created.

After this you need to find your theme ID to know which folder to look for (if you have more then 1 theme).

 

Hope is useful for you.

Link to comment
Share on other sites

Hey thanks for the reply. I did learn something about using language phrases in IPS4.

It seems like if I have 20 pages then I will have to make 20 language phrases. Is this correct?

The solution I am after will take one piece of code that will dynamically pull the page title from the database and insert it into page.

<h3 class='ipsType_reset ipsWidget_title'>{{$varible_for_page_title}}</h3>

However, I can't seem to figure out how to get $varible_for_page_title to work.

Link to comment
Share on other sites

So I figured this out. For templates the following code will display the page name. I created a custom template and put this code in and the title was displayed. The page title changed, as expected, depending on which page I was on.

{$page->_title}

However, I still can't get this to display inside a block. I am using 4 blocks inside a template. But I can't get {$page->_title} to work in any type of block. I have tried HTML and Page Builder pages. It also doesn't work inside the content area of an HTML page. Does anyone have an explanation?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...