Page Title

More
13 years 2 months ago #19546 by openg
Page Title was created by openg
Hi There,

I am trying to display the page title dynamically in multiple posts using a third party PHP module that loads code into a flexicontent item.

I am using this code <?php $doc =& JFactory::getDocument(); echo '' . $doc->getTitle(); ?> which normally returns the page title, yet in this case it displays the category that the item is in rather than the page title itself.

What code would I have to use to display the page title and not the category within the item.

Many kind regards,

Dominic

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #19547 by ggppdk
Replied by ggppdk on topic Page Title
The following code will work with flexicontent v1.5.6

You can use it anywhere, inside some component, module or plugin
Code:
if (JRequest::getVar('option')=='com_flexicontent' && JRequest::getVar('view')=='items' ){ JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'tables'); require_once("components/com_flexicontent/classes/flexicontent.fields.php"); require_once("components/com_flexicontent/classes/flexicontent.helper.php"); require_once("components/com_flexicontent/models/items.php"); // Get current displayed Flexicontent item $itemmodel = new FlexicontentModelItems(); $item = $itemmodel->getItem(); FlexicontentFields::getFields(array(&$item)); // Get html of fields $title = FlexicontentFields::getFieldDisplay($item, 'title'); $voting = FlexicontentFields::getFieldDisplay($item, 'voting'); $hits = FlexicontentFields::getFieldDisplay($item, 'hits'); $created_by = FlexicontentFields::getFieldDisplay($item, 'created_by'); // $title has the title you need echo $title; }


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #19571 by openg
Replied by openg on topic Page Title
Thanks for the reply.
However I can't get the title to appear, is there something else I should add?

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #19574 by ggppdk
Replied by ggppdk on topic Page Title
Corrected the above code, i had missed a letter J infront of Table::, and also removed & in the function calls.

NOTE: it will work with v1.5.6

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #19575 by openg
Replied by openg on topic Page Title
Many many thanks for that, the new code works perfectly ;)

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #19581 by ggppdk
Replied by ggppdk on topic Page Title
Same code can be used to enhance and other components e.g. com_search ... search for a relevant post here

www.flexicontent.org/forum/index ... =viewtopic


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.500 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline