Coachonko Posted May 2, 2022 Posted May 2, 2022 (edited) I can get links to pages with the following smarty tags {$link->getPageLink('contact')|escape:'html':'UTF-8'} {$link->getCategoryLink(4)|escape:'html':'UTF-8'} {$link->getCmsLink(9)|escape:'html':'UTF-8'} Is there a way to get page titles instead of having to use the {l s='title'} tags? Edited May 2, 2022 by Coachonko
0 datakick Posted May 2, 2022 Posted May 2, 2022 It's doable, but not very friendly. Look what static methods are available in Meta class. You could you getMetaByPage, or getCategoryMetas or getCmsMetas {assign var='contactMeta' value=Meta::getMetaByPage('contact', $lang_id)} {assign var='categoryMeta' value=Meta::getCategoryMetas(4, $lang_id, 'category')} {assign var='cmsMeta' value=Meta::getCmsMetas(9, $lang_id, 'cms')} <pre> contact title = {$contactMeta.title} category title = {$categoryMeta.meta_title} cms title = {$cmsMeta.meta_title} </pre>
0 Coachonko Posted May 2, 2022 Author Posted May 2, 2022 (edited) Thanks! This can be very useful when there is a large amount of these links, dynamically getting title is much faster than editing translations. 6 hours ago, datakick said: It's doable, but not very friendly. Look what static methods are available in Meta class. You could you getMetaByPage, or getCategoryMetas or getCmsMetas {assign var='contactMeta' value=Meta::getMetaByPage('contact', $lang_id)} {assign var='categoryMeta' value=Meta::getCategoryMetas(4, $lang_id, 'category')} {assign var='cmsMeta' value=Meta::getCmsMetas(9, $lang_id, 'cms')} <pre> contact title = {$contactMeta.title} category title = {$categoryMeta.meta_title} cms title = {$cmsMeta.meta_title} </pre> contactMeta works perfectly categoryMeta works but it seems like thirty bees appends the name of the website to the title, so the output should be processed. The cmsMeta doesn't seem to work. If how do you fetch the name of the page instead of the meta title? Edited May 2, 2022 by Coachonko
Question
Coachonko
I can get links to pages with the following smarty tags
{$link->getPageLink('contact')|escape:'html':'UTF-8'} {$link->getCategoryLink(4)|escape:'html':'UTF-8'} {$link->getCmsLink(9)|escape:'html':'UTF-8'}
Is there a way to get page titles instead of having to use the {l s='title'} tags?
Edited by Coachonko2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now