Elxis CMS Forum

Support => General => Topic started by: striker on June 23, 2016, 13:00:10

Title: Where is the core file that has $eDoc->showHead();
Post by: striker on June 23, 2016, 13:00:10
Hi Datahell and Elxis Dev Team,

Can you please direct me where exactly is this function located, $eDoc->showHead(); ?

I know that it generates the meta tags, links, etc. but I just want to add something in that function.

I tried searching it from the com_content files but failed to fine the exact location.

Thanks,
Title: Re: Where is the core file that has $eDoc->showHead();
Post by: evkarab on June 23, 2016, 16:09:38
I am an amateur and may be wrong but I think this is the file you are looking for : includes/libraries/elxis/document.class.php
Title: Re: Where is the core file that has $eDoc->showHead();
Post by: datahell on June 23, 2016, 19:36:58
Yes, it is the document.class.php file. You don't have to modify that function. The function displays what it is required by the running extensions to be displayed. If you remove something then something might broke and you will face errors.  If you want to add something to the output you can use in any extension (template, module, component, etc) any of the add* functions of the document library (addStyle, addStyleLink, addScript, addScriptLink, addLibrary, addJQuery, addDocReady, addCustom, addLink). Especially with the addCustom method you can add ANYTHING to the document's head section.

$eDoc->addCustom('<test>Wow, I can add anything in head!</test>');

elxisDocument documentation (https://www.elxis.net/docs/developers/libraries/elxisdocument.html)
Title: Re: Where is the core file that has $eDoc->showHead();
Post by: striker on June 24, 2016, 12:58:41
Hi datahell,

I always read the documentation before posting here in the forum but I'm just quite puzzled why this line won't work if I insert it on my template's head section?

$eDoc->addCustom('<meta property="og:image" content="'.$elxis->secureBase().'/'.$row->image.'"/>');

The $row->image piece isn't rendering the image URL.

GOALs:
1. I want to add og tags manually without the use of any plugin.
2. would only render og tags in articles or posts (not in category or other locations)
Title: Re: Where is the core file that has $eDoc->showHead();
Post by: datahell on June 25, 2016, 07:47:12
$row->image is wrong, does not exist. Use the functions before you display the head in template index.php file.