Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Action_Builder Posted March 11, 2016 Posted March 11, 2016 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';}}
Teascu Dorin Posted March 12, 2016 Posted March 12, 2016 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.
Action_Builder Posted March 12, 2016 Author Posted March 12, 2016 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.
Action_Builder Posted March 13, 2016 Author Posted March 13, 2016 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?
Teascu Dorin Posted March 13, 2016 Posted March 13, 2016 Hello, To get a page title can be more complicated. Maybe someone else can help in this meter. I am just a beginner in HTML and templates. I learned by doing as some are saying.
BomAle Posted March 16, 2016 Posted March 16, 2016 check this guide but now i don't know if on request there is stored the title of page... i will check soon the php class that handle the blocks is "\IPS\cms\Blocks\Block"
Recommended Posts
Archived
This topic is now archived and is closed to further replies.