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?
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'm a beginner in writing PHP, but working on developing themes in WordPress.
I have no idea how to echo my style option within my front-page.php.
My meta.php:
$meta_style = array();
$meta_style['meta_style'] = array(
'dash_icon' => 'list-view',
'title' => __('Section Settings', 'fluent'),
'description' => __('These are general section settings.','fluent'),
'context' => 'normal',
'priority' => 'high',
'option_name' => 'meta_style',
'caps' => array(),
'fields' => array(
'style' => array(
//...
'type' => 'select',
'options' => array(//option value = option label
'value' => 'white',
'value2' => 'black'
),
'multiple' => false,//allow multiple values to be selected - default false
'placeholder' => 'white'//placeholder text for the element
),
),
);
My front-page.php (it's wrapped in a BUTTON just a see if the variable echoes):
<button>
<? if($meta = get_post_meta($post->ID)){ if($meta['style'] == true){ echo $meta['value']; } } ?>
</button>
Can anyone provide an additional examples on how to echo other types, such as 'type' => 'text'?
I dont know exactly what you want, but you should:
1 - See if you're echoing the right information
2 - Use var_dump()
In your first code example you have a variable $meta_style which is a map. It has one key, 'meta_style' that leads to a next map. Inside that inner map you have the keys 'dash_icon' and so on. So for example this should echo the string 'normal':
echo $meta_style['meta_style']['context'];
However, in your second example, you have a variable $meta which is also a map, having keys 'style' and 'value'. You could echo those with:
echo $meta['style'];
echo $meta['value'];
Based on your example, I have no idea what these should do or how they should be related, or what their meaning should be.
I'm using Yiibooster and the TbGridView to show some results. I'm also using the following code to provide smart looking icons to a view, update and delete link.
array(
'htmlOptions' => array('nowrap'=>'nowrap'),
'class'=>'bootstrap.widgets.TbButtonColumn',
'viewButtonUrl'=>'Yii::app()->createUrl("/item/view", array("id"=>$data["id"], "sector" => $data["sector"]["slug"],"title" => $data["slug"]))',
'updateButtonUrl'=>'Yii::app()->createUrl("/item/update", array("id"=>$data["id"]))',
'deleteButtonUrl'=>null,
)
What I'd like to do is basically be able to show another button in there or in replace of the delete button. I'm just unsure how (or where specifically) I need to code the values for the this button.
I'm currently looking at the TbButtonColumn.php file and tried just adding a button just to see if it would work it didn't.
What would be the correct process to to do this?
Thanks in advance
Jonny
There is a buttons parameter for additional buttons, it is in docs od CButtonColumns, here is sample from link:
array(
'class'=>'CButtonColumn',
// Template to set order of buttons
'template' => '{postview} {preview}',
// Buttons config
'buttons' => array(
'postview' => array(
'label' => '...', // text label of the button
'url' => '...', // the PHP expression for generating the URL of the button
'imageUrl' => '...', // image URL of the button. If not set or false, a text link is used
'options' => array(...), // HTML options for the button tag
'click' => '...', // a JS function to be invoked when the button is clicked
),
'preview' => array(
// Another button config
),
),
),
NOTE: This is example for CButtonColumn but TbButtonColumn is a subclass of CButtonColumn, so everything applies to both.
I am using WordPress social media plug-in. When any user clicks on icon it opens the link in new tab, but i want it in new window, so for this purpose i am using Javascript function
<script type="text/javascript">
// Popup window code
function newPopup(url) {
popupWindow = window.open(
url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>
But the main problem is my code is written in PHP and i don't have any idea how to use javascript function in it. Here is my PHP function.
$out_button = array(
'tag' => 'a',
'class' => 'synved-social-button synved-social-button-' . $context . ' synved-social-provider-' . $button_key . $class_extra,
'data-provider' => $button_key,
'target' => $button_key != 'mail' ? '_blank' : '',
'rel' => 'nofollow',
'title' => $title,
'href' => $href,
'child-list' => array(
array(
'tag' => 'img',
'alt' => $button_key,
'class' => 'synved-share-image',
'width' => $size,
'style' => 'width:' . $size . 'px;' . $style,
'src' => $image_uri,
)
)
);
'href' => $href, In this i have to write the Javascript function so any idea how can i do it.
It looks as though your php array should be setting the target to _blank if the key isn't mail. If you just set
'target' => '_blank',
does that give you your desired result?
How about adding an onclick event handler?
onclick = "Some_JavascriptFunction()"
then in javascript you can use window.location.href = "someURL.php";
I am using zend form to create an radio button element. How do I align them horizontally.
$this->addElement('radio', 'howYouFeel3', array(
'onClick' => 'showFields(this);',
'required' => true,
'multiOptions' => array(
'Positive' => 'Positive',
'negative' => 'Negative',
)
));
I have tried adding:
'setSep' => '',
and
'separator' => '',
and
'setSeparator' => ''
But none worked.
Also tried:
$howYouFeel3 = new Zend_Form_Element_Radio('howYouFeel3');
$howYouFeel3
->setLabel('How you Feel?')
->setSeparator('')
->addMultiOptions(array(
'positive' => 'Positive',
'negative' => 'Negative'
));
$this->addElement($howYouFeel3);
Have looked at the source code and it seems the code is creating the radio buttons in li tags in an ul unlike others in the situation with the same problem who have an at the end. This is perhaps why the seperator thing doesnt work.
This question has been asked before
here, the accepted answer should show you how to go about this.
Edit:
Have you tried: array("listsep" => ' ')
It seems to be the universal solution, here is another example
You can use setSeperator function to align the radiobuttons
$radio= new Zend_Form_Element_Radio('status');
$radio->setSeparator(' ');