Skip to content

Instantly share code, notes, and snippets.

@iamrobert
Created August 12, 2018 10:20
Show Gist options
  • Select an option

  • Save iamrobert/5e9725e2029eb1153be084c3e5fefcee to your computer and use it in GitHub Desktop.

Select an option

Save iamrobert/5e9725e2029eb1153be084c3e5fefcee to your computer and use it in GitHub Desktop.
iamrobert joomla template - includes/header.php
<?php
/* iamrobert.com | TAIWAN -------------------------------------------------
_ __ __
(_)__ ___ _ _______ / / ___ ____/ /_
/ / _ `/ ' \/ __/ _ \/ _ \/ -_) __/ __/
/_/\_,_/_/_/_/_/ \___/_.__/\__/_/ \__/
===================================================== DIGITAL DESIGN STUDIO
# author Robert Stark
# copyright Copyright © 2017 iamrobert.com All rights reserved.
# Website http://www.iamrobert.com
----------------------------------------------------------------------------
+ CALL FONTS - preload fonts
+ INLINE CSS - call template /css/inline.css
+ SOCIAL - FB / TWITTER for Rich Snippets
+ CSS template.css
+ FAVICONS
+ GOOGLE ANALYTICS
-------------------------------------------------------------------------*/
defined('_JEXEC') or die;
?>
<?php
/*
+ CALL FONTS
----------------------------------------------------------------------
https://bit.ly/2qIvJJu
======================================================================
*/
?>
<link rel="preload" href="<?php echo $tpath; ?>/fonts/AkzidenzGroteskBE-Md.woff2" as="font" crossorigin>
<link rel="preload" href="<?php echo $tpath; ?>/fonts/AkzidenzGroteskBE-Regular.woff2" as="font" crossorigin>
<link rel="preload" href="<?php echo $tpath; ?>/fonts/ky.woff2" as="font" crossorigin>
<?php
/*
+ INLINE CSS - call template /css/inline.css
----------------------------------------------------------------------
https://developers.google.com/speed/docs/insights/OptimizeCSSDelivery
======================================================================
*/
$document = JFactory::getDocument();
$siteURL='http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['SERVER_NAME'];
$inlineStyle= file_get_contents ($siteURL.$tpath.'/css/inline.css');
echo '<style>'.$inlineStyle.'</style>';
?>
<jdoc:include type="head" />
<?php
/*
+ SOCIAL - FB / TWITTER for Rich Snippets
----------------------------------------------------------------------
Set in Template Administrator
======================================================================
*/
//// ADD FACEBOOK PAGE ID
$document = JFactory::getDocument();
if ( !$developerMode ) {
if ( isset( $fb_admin_id ) ) {
if ( $fb_admin_id != '123456' ) {
$document->setMetaData( 'fb:admins', '' . $fb_admin_id . '' );
}
}
//// ADD TWITTER PAGE ID
if ( isset( $twitter_user_name ) ) {
if ( $twitter_user_name != '123456' ) {
$document->setMetaData( 'twitter:creator', '' . $twitter_user_name . '' );
}
}
}
?>
<?php
/*
+ CSS template.css
======================================================================
*/
if ($developerMode) : ?>
<link rel="stylesheet" href="<?php echo $tpath; ?>/css/template.css.php?v=<?php echo rand();?>"/>
<?php else:?>
<link rel="stylesheet" href="<?php echo $tpath; ?>/css/template.css.php?v=<?php echo date("YmdHis",filemtime($tmpl_path . '/css/template.css')); ?>">
<?php endif;?>
<?php
/*
+ FAVICONS
----------------------------------------------------------------------
http://realfavicongenerator.net/
======================================================================
*/
?>
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo $tpath; ?>/images/favi/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo $tpath; ?>/images/favi/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="<?php echo $tpath; ?>/images/favi/favicon-16x16.png">
<link rel="manifest" href="<?php echo $tpath; ?>/images/favi/site.webmanifest">
<link rel="mask-icon" href="<?php echo $tpath; ?>/images/favi/safari-pinned-tab.svg" color="#b19f6a">
<meta name="msapplication-TileColor" content="#2d89ef">
<meta name="theme-color" content="#ffffff">
<?php
/*
+ GOOGLE ANALYTICS
-----------------------------------------------------------------------
Set in Template Administrator
======================================================================
*/
if (!$developerMode) : ?>
<?php if ($analytics != "UA-XXXXX-X") : ?>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo $analytics;?>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<?php echo $analytics;?>');
gtag('set', {'user_id': 'USER_ID'});
</script>
<?php endif;?>
<?php endif;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment