Skip to content

Instantly share code, notes, and snippets.

View victorpavlov's full-sized avatar

Victor Pavlov victorpavlov

View GitHub Profile
@victorpavlov
victorpavlov / magento-remove-user-toplinksm.xml
Created February 5, 2013 13:52
XML: Magento remove links from toplinks
<customer_logged_out>
<reference name="top.links">
<!-- Removes 'Log In' link - Default position: 60
<action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>-->
<action method="removeLinkByUrl"><url helper="customer/getAccountUrl"/></action>
<action method="addLink" translate="label title" module="customer"><label>Registration</label><url helper="customer/getRegisterUrl"/><title>Registration</title><prepare/><urlParams/><position>10</position></action>
<remove name="wishlist_link"/>
</reference>
</customer_logged_out>
@victorpavlov
victorpavlov / add_sj_valid.js
Last active December 13, 2015 16:59
JavaScript: Valid script insert in body
<script type="text/javascript">
// <![CDATA[
// ]]>
</script>
@victorpavlov
victorpavlov / joomla_add_js.php
Last active December 14, 2015 18:29
PHP:Joomla add JavaScript File
<?php
$document = JFactory::getDocument();
$document->addScript(JURI::base().'templates/your_template_name/js/your.custom.js');
?>
@victorpavlov
victorpavlov / magento_add_block.xml
Created March 25, 2013 21:50
XML: Add Magento Block via XML
<reference name="right">
<block type="cms/block" name="new_block" after="cart_sidebar">
<action method="setBlockId"><block_id>new_block</block_id></action>
</block>
</reference>
/***** Selector Hacks ******/
/* IE6 and below */
* html #uno { color: red }
/* IE7 */
*:first-child+html #dos { color: red }
/* IE7, FF, Saf, Opera */
html>body #tres { color: red }
@victorpavlov
victorpavlov / CSS:google_chrome_hacks.css
Created April 1, 2013 12:37
Individual for Google Chrome and some webkit browsers, and Opera in some cases
/* will be red only in google chrome */
@media screen and (-webkit-min-device-pixel-ratio:0) {
#test1{color:red;}
}
/* will be red only in opera and google chrome */
#test2 {
color:green;
-bracket-:hack(;
color:red;
@victorpavlov
victorpavlov / joomla25:hide_sys_message.php
Last active December 15, 2015 17:49
Joomla2.5:hidesystem messagу div
<?php if(JFactory::getApplication()->getMessageQueue()) : ?>
<jdoc:include type="message" />
<?php endif; ?>
@victorpavlov
victorpavlov / php:remove()_from_str.php
Created April 7, 2013 19:13
PHP: remove "()" from string
<? $tracking = preg_replace("#(.*?)\(.*?\)(.*?)#is", "\\1\\3", $tracking); ?>
@victorpavlov
victorpavlov / drupal7-url-vars.php
Created May 21, 2013 07:12
PHP: Drupal 7 URL variables
<?php
//Drupal 7 URL variables
$GLOBALS['base_url'] => http://example.com/drupal
base_path() => /drupal/
request_uri() => /drupal/documentation?page=1
request_path() => documentation
current_path() => node/26419
?>
<?php
function MYTHEME_preprocess_node(&$vars) {
if($vars['view_mode'] == 'teaser') {
$vars['theme_hook_suggestions'][] = 'node__' . $vars['node']->type . '__teaser';
$vars['theme_hook_suggestions'][] = 'node__' . $vars['node']->nid . '__teaser';
}
}
?>