Skip to content

Instantly share code, notes, and snippets.

View Yiannistaos's full-sized avatar
🏠
Working from home

Yiannis Christodoulou Yiannistaos

🏠
Working from home
View GitHub Profile
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
// Send Email
function sendEmail($email_recipient = '', $subject = 'The mail subject goes here...', $body = 'The mail body goes here..')
{
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$sender = array($config->get('fromname'), $config->get('mailfrom'));
$email_recipient = (!empty($email_recipient)) ? $email_recipient : $config->get('mailfrom');
$mailer->setSender($sender);
$mailer->setSubject($subject);
$mailer->isHTML(true);
@Yiannistaos
Yiannistaos / gist:4cc24e6e6c43e90bdce92e59c072ebdc
Created March 10, 2017 10:09 — forked from mbabker/gist:3211464
Creating a category via component postflight
// Get the database object
$db = JFactory::getDbo();
// JTableCategory is autoloaded in J! 3.0, so...
if (version_compare(JVERSION, '3.0', 'lt'))
{
JTable::addIncludePath(JPATH_PLATFORM . 'joomla/database/table');
}
// Initialize a new category
@Yiannistaos
Yiannistaos / find.php
Last active June 6, 2019 23:41
How to display the multiple categories at K2 User's page? (FIND)
<div class="userItemCategory">
<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
<a href="/<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a>
</div>
@Yiannistaos
Yiannistaos / replace.php
Last active June 6, 2019 23:41
How to display the multiple categories at K2 User's page?
<?php
// BEGIN: Multiple Categories for K2, by Web357
$w357_dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2', 'k2multiplecategories');
$k2multiplecategories = $w357_dispatcher->trigger('onK2AfterDisplayContentAdvanced', array($item));
if (!empty($k2multiplecategories) && is_array($k2multiplecategories)):
?>
<!-- Item category name -->
<div class="userItemCategory">
<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
<cpnb>
<script>
// The Javascript code goes here...
</script>
</cpnb>
@Yiannistaos
Yiannistaos / gist:2d0029caecf6d3e7d66c19318d38abf0
Created July 9, 2019 12:14
Block scripts from a specific Cookie Category
<cpnb data-cpnb-cookie-category-id="analytical-cookies">
<script>
// The Javascript code for Analytical cookies (only) goes here...
</script>
</cpnb>
@Yiannistaos
Yiannistaos / gist:09f8a5e010c15211c970cb5a3be35df9
Last active July 9, 2019 12:22
How to block cookies by using the {cpnb} tags
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WEB357012345');</script>
<!-- End Google Tag Manager -->
</head>
@Yiannistaos
Yiannistaos / gist:8b8b5c27bfeef5c13ebed8133f0c3be4
Created July 9, 2019 12:19
How to block cookies by using the {cpnb} tags : Add after the <body>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P6BZQ92"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
@Yiannistaos
Yiannistaos / gist:1ae3372c7734d52270b8e4a162826e4d
Created July 9, 2019 12:20
With the <cpnb> tags should be like this: Add before the </head>
<cpnb data-cpnb-cookie-category-id="analytical-cookies">
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WEB357012345');</script>
<!-- End Google Tag Manager -->
</cpnb>
</head>