###################
QUESTION
Does anyone knows how to call either "Intro Image" or "Full Article Image" inside the index.php using PHP code?
I know this can be done inside the articles default.php files or similar.
But I want to know if this can be accomplished inside the index.php
##################
EXAMPLE
For instance, I have the following HTML markup inside the index.php on
Code: Select all
<meta property="og:image" content="">
Code: Select all
<meta property="og:image" content="<?php echo $IntroImage = $doc->getIntroImage(); ?>">
CALLING TITLES AND DESCRIPTION IS POSSIBLE
I know I can call titles and descriptions with the PHP codes below.
But I have not been able to find how this can be done with the images.
Code: Select all
<meta property="og:title" content="<?php echo $Title = $doc->getTitle(); ?>">
<meta property="og:description" content="<?php echo $Description = $doc->getDescription(); ?>">
Code: Select all
<?php
defined( '_JEXEC' ) or die( 'Restricted access' ); //Basic protection for PHP Joomla files
$doc = JFactory::getDocument();
$doc->setHtml5(true); //Change document to HTML5
/* THIS GET ALIAS INSIDE BODY CLASS FOR CUSTOM CSS */
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive();
$pageclass = ''; // Notice how the variable is empty first. Then place the code below.
if (is_object($menu))
$pageclass = $menu->params->get('pageclass_sfx');
?>
<!doctype html>
<html lang="<?php echo $this->language; ?>">
<head>
<!-- HEAD GENERATED BEGINS -->
<jdoc:include type="head" />
<!-- HEAD GENERATED ENDS -->
<!-- SOCIAL MEDIA TEST BEGINS -->
<meta property="og:image" content="">
<!-- SOCIAL MEDIA ENDS -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="format-detection" content="telephone=no">
<?php $this->setGenerator('Website powered by Engines'); ?>
<link href="<?php echo JUri::current(); ?>" rel="canonical">
<link rel="alternate" hreflang="<?php echo $this->language; ?>" href="<?php echo JUri::current(); ?>">
</head>