I 'm developing a wordpress theme. I have just integrate flexslider.
This is my settings default :
$.flexslider.defaults = {
namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
animation: "fade", //String: Select your animation type, "fade" or "slide"
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
reverse: false, //{NEW} Boolean: Reverse the animation direction
animationLoop: "enable_animation_slider", //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
slideshow: true, //Boolean: Animate slider automatically
slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
randomize: false, //Boolean: Randomize slide order
thumbCaptions: false,
In my theme-options.php i have create this :
/* Slider Settings */
array(
'label' => 'Enable animation loop Slider',
'id' => 'enable_animation_slider',
'type' => 'checkbox',
'desc' => 'Check if you want to disable loop',
'choices' => array(
array(
'label' => 'false',
'value' => 'false'
)
),
'std' => 'false',
'rows' => '',
'post_type' => '',
'taxonomy' => '',
'class' => '',
'section' => 'slider_default'
),
My problem is flexslider do not grab id enable_animation_slider and settings admin panel not work.
Related
I'm trying to add a new field to Admin Preferences - a textarea field with tinymce. I've added code to AdminPreferencesController.php:
$this->fields_options['contact'] = array(
'title' => $this->l('Contact'),
'icon' => 'icon-cogs',
'submit' => array('title' => $this->l('Save')),
);
$this->fields_options['contact']['fields']['PS_CONTACT_ADDITIONAL_INFO'] = array(
'type' => 'textarea',
'label' => $this->l('Short description'),
'name' => 'short_description',
'lang' => true,
'cols' => 60,
'rows' => 10,
'autoload_rte' => 'rte',
'col' => 6,
);
But tinymce doesnt' appear and when I'm using HTML tags after saving they disappear. Presta strips all HTML tags.
How to allow HTML tags on this field and enable tinymce?
It seems that you can't just add it in a regular way. But you can implement it in a next way.
First of all, use field type textareaLang instead of textarea and add a parameter 'validation' => 'isCleanHtml' to this field
$this->fields_options['contact']['fields']['PS_CONTACT_ADDITIONAL_INFO'] = array(
'type' => 'textareaLang',
'label' => $this->l('Short description'),
'name' => 'short_description',
'lang' => true,
'cols' => 60,
'rows' => 10,
'col' => 6,
'validation' => 'isCleanHtml'
);
Create your own script to initialize your editor. I created a script tinymce.init.js and put it to js/admin/ folder
$(document).ready(function(){
ad = ''; // this is defenition of the external plugin path. I didn't fint how it can impact on script if it's empty but by default it it the path to your admin folder
iso = iso_user;
var config = {
selector: '.textarea-autosize'
};
tinySetup(config);
});
Then include tinymce script and your own to this controller AdminPreferencesController.php
public function setMedia()
{
$this->context->controller->addJquery();
$this->context->controller->addJS(
array(
_PS_JS_DIR_.'admin/tinymce.init.js',
_PS_JS_DIR_.'tiny_mce/tiny_mce.js',
_PS_JS_DIR_.'admin/tinymce.inc.js'
)
);
parent::setMedia();
}
It should implement your requirements. But don't forget that now you should call your configuration field in multilingual scope. So, add a language id to Configuration::get() like
Configuration::get('PS_CONTACT_ADDITIONAL_INFO, $id_lang)
whenever you use it.
P.S. Bear in mind that the best solution for your goal is to create a simple module which will handle this. And far more, it is recommended way.
I am using codeigniter and I need to have a popup window. I used the anchor_popup function. Here is my code:
<?php
$attributes = array(
'class' => 'blue-button',
'width' => '800',
'height' => '600',
'resizable' => 'no',
'screenx' => '\'+((parseInt(screen.width) - 800)/2)+\'',
'screeny' => '\'+((parseInt(screen.height) - 600)/2)+\'',
);
echo anchor_popup('admin/employee/add', 'Start Worksheet', $attributes);
?>
This opens a new window with the close, minimize, and maximize buttons But I need to disable or hide the minimize and maximize buttons. How can I do this?
I am trying to select week using datepicker in Yii . I have the following code.
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name'=>'accountingweekselect',
'value' => date('d-M-y'),
'flat'=>true,
'htmlOptions' => array(
'size' => '10', // textField size
),
'options'=>array(
'dateFormat'=>'yy-m-dd',
'firstDay'=> 5,
'onSelect' => 'js: function(dateText, inst){
//$("#accountingweekselect_container").datepicker("setDate",dateText );
}',
'maxDate' => 'today',
'selectWeek'=>true,
)
));
?>
I would liek to make it work like the following link. http://2008.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerSelectWeek.html
Maybe i can use onselect to get the day selected and use css to highlight the row. The following code only logs the container and not the day you select.
'onSelect' =>
'js:function() {
// to automatically assign check out date input value
console.log(this);
}',
updated code
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name'=>'accountingweekselect',
'value' => date('d-M-y'),
'flat'=>true,
'htmlOptions' => array(
'size' => '10', // textField size
),
'options'=>array(
//'dateFormat'=>'yy-m-dd',
'dateFormat'=>'yy-mm-dd',
//'firstDay'=> 5,
'showOtherMonths'=>true,// Show Other month in jquery
'selectOtherMonths'=>true,// Select Other month in jquery
'onSelect' => 'js: function(dateText, inst){
console.log($("#accountingweekselect_container div table tbody tr td").children("a.ui-state-active").html());
console.log($("#accountingweekselect_container div table tbody tr td.ui-datepicker-current-day").children("a").html());
}',
//'maxDate' => 'today',
/*'onSelect' =>
'js:function() {
// to automatically assign check out date input value
console.log(this);
}',*/
'selectWeek'=>true,
)
));
I have commented out all extra options and still doe snot work. below is code from source
jQuery('#accountingweekselect_container').datepicker({'dateFormat':'yy-mm-dd','selectWeek':true,'defaultDate':'03-Nov-14','altField':'#accountingweekselect'});
i want to send manufacturer email when order is made . For that i want to add email address of manufacturer in Manufacturer product attribute ? How to achieve this ?
I'm gonna assume that you are asking how to do it in code? Anyway, just build a small module with an install script (tutorials all over the web), and make the setup script look something like this:
$installer = $this;
$installer->startSetup();
// check if the attribute exists
if (Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','calculated_sold')->getId() !== NULL) {
$installer->removeAttribute('catalog_product', 'calculated_sold');
}
// not anymore, that's for sure!
// Note! For product attributes the XML set class needs to be "Mage_Catalog_Model_Resource_Setup"
// instead of "Mage_Customer_Model_Entity_Setup" as you would usually go with.
$installer->addAttribute('catalog_product','calculated_sold', array (
'type' => 'decimal',
'label' => 'Calculated sold',
'input' => 'price', // for filtering to work only certain input types allowed
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'searchable' => true,
'filterable' => true,
'visible' => false,
'required' => false,
'visible_in_advanced_search' => true,
'used_in_product_listing' => true,
'used_for_sort_by' => true,
'apply_to' => 'configurable', // yeah!
));
$installer->endSetup();
This example adds an attribute to keep track of how many items are sold, but it will give you an idea of how to change it for your own needs.
I've added some div wrapper styles to Wordpress, but when I use them in the page, it is impossible to add content below them in the page. CSS:after works inside the divs to create a selectable area, but it doesn't work to create a selectable area after the div.
In my functions.php I have:
function my_mce_before_init( $settings ) {
$style_formats = array(
array(
'title' => 'Box Two Columns',
'block' => 'div',
'classes' => 'twocolbox',
'wrapper' => true
),
array(
'title' => 'Image with Caption',
'block' => 'div',
'classes' => 'img_caption',
'wrapper' => true
),
array(
'title' => 'Gallery Horizontal',
'block' => 'div',
'classes' => 'scroller horizontal',
'wrapper' => true
)
);
$settings['style_formats'] = json_encode( $style_formats );
return $settings;
}
add_filter('tiny_mce_before_init', 'my_mce_before_init');
add_editor_style();
Is there a way to use execCommand here to add some html after the div styles I defined? To add something like an empty paragraph tag afterwards with a clear float?
I tried:
tinyMCE.execCommand('mceInsertContent',false,'Hello world!!');"
MCE editor breaks then.
...
Tried this but it's too buggy:
In editor-styles.css:
#tinyMCE:after {
content: " ";
clear:both;
width: 4em; height:4em;
}
Note that you may need to clear cache AND shift-reload button to see any changes to editor-styles.css in Wordpress.
...
Still working on this. Found a thread:
To access tinymce iframe elements through jquery
I tried adding the code in this thread to my_mce_before_init, but it just broke.
....
Also tried loading a jQuery script, but the target paths wouldn't work on the TinyMCE iframe. None of these selectors work:
jQuery(document).ready(function($) {
$("#tinyMCE").find("div").after('<p style="width:100%; clear:both; height:1em;"> 6789</p>');
$("div").css("color","red");
$("#content_ifr").contents().find("div").after('<p style="width:100%; clear:both; height:1em;"> 6789</p>');
$("#content_ifr").contents().find("#tinymce p").css("color","red");
$("#wp-content-editor-container").find("textarea").css("color","red");
$("iframe").contents().find("p").css("color","red");
$('#content_ifr').load(function(){
$('#content_ifr').contents().find('p').css("color","red");
});
});
You can add html pseudo elements using the tinymce configuration option content_css.
There you can define after elements. Give it a try!
Update:
When initializing tinymce set the setup paramter to the following (inside tinyMCE.init({...})
...
theme: "advanced", // example param
setup : function(ed) {
ed.onInit.add(function(ed, evt) {
$("#content_ifr").contents().find("p").css("color","red");
// other approach
//$(ed.getBody()).find('p').css("color","red");
});
},
cleanup: true, // example param
...