How to call tooltip in joomla 2.5? - joomla

In default.php
JHTML::_('behavior.tooltip');
<a href="#">
<?php echo JHTML::tooltip('test test test', 'title', '', 'title');?></a>
But it can't show tooltip ? How to fix it ?

A tooltip for text is done as so:
JHtml::_('behavior.tooltip');
echo JHtml::tooltip('Tooltip Text', 'Tooltip Title', '', 'Text to be hovered over');
and a tooltip for an image, can be done like so:
JHtml::_('behavior.tooltip');
JHtml::tooltip('Tooltip Text', 'Tooltip title', 'tooltip.png', '', '', false);
For more information, please read the Joomla Docs on Tooltips:

Related

Change icon sweetalert with image

I want to ask how can I change icon image in sweetalert with image?
I've tried change icon image in Swal.fire with image from assets, but it's not working
Here's the script
Swal.fire({
icon: "<?= base_url(); ?>assets/addon-media/icon_information.png",
html: "Are you sure want to add this ?",
showCancelButton: true,
confirmButtonText: 'Yes, Sure',
cancelButtonText: 'No, Cancel',
})
You can set the image for an icon by using the iconHtml param. Also, if you'd like to remove the default border around the icon, use the customClass param.
Here's the example:
Swal.fire({
title: 'Image icon',
iconHtml: '<img src="https://picsum.photos/100/100">',
customClass: {
icon: 'no-border'
}
})
.no-border {
border: 0 !important;
}
<script src="https://cdn.jsdelivr.net/npm/sweetalert2#11"></script>

Sweetalert2 javascript (progresStep)

So, I'm having some problem with sweetalert2 (I'm new here).
I have this script and i don't know how to make to be with progress step (see the .gif below)
Set Premium Points</li>
<script>
function givepptoplayer() {
swal({
title: 'Change User Premium Points <?php echo $data->name ?>',
input: 'number',
showCancelButton: false,
confirmButtonText: 'edit',
showLoaderOnConfirm: true,
confirmButtonClass: 'btn btn-success',
cancelButtonClass: 'btn btn-danger m-l-10',
allowOutsideClick: false,
inputValue: '',
}).then(function (result) {
$.post('<?php echo config::$_PAGE_URL ?>api/finishthis', { 'userid' : '<?php echo $data->id ?>', 'changePP': result.value}, function(result)
{
swal({
type: 'success',
title: 'Succes!',
html: result
});
});
});
}
</script>
I want when to make a progressStep something like here: https://gyazo.com/41f65065108e3937e3afc2a3064ee028
Can you guys give me an example please?
There is an example of chaining modals with related code on https://sweetalert2.github.io/#chaining-modals. Basically the code is:
swal.mixin({
input: 'text',
confirmButtonText: 'Next →',
showCancelButton: true,
progressSteps: ['1', '2', '3']
}).queue([
{
title: 'Question 1',
text: 'Chaining swal2 modals is easy'
},
'Question 2',
'Question 3'
]).then((result) => {
if (result.value) {
swal({
title: 'All done!',
html:
'Your answers: <pre><code>' +
JSON.stringify(result.value) +
'</code></pre>',
confirmButtonText: 'Lovely!'
})
}
})

Cakephp ajax insert without using cake ajaxhelper

I am trying to add data in cakephp by ajax without using ajax helper.Here insertion is working fine but problem is after insert data I have failed to see the success massage.Here is my effort.
<script>
$(document).ready(function(){
$('#submit').click(function(){
x=$("#rform").serializeArray();
$.post($("#rform").attr("action"),
x,
function(data)
{
$("#success").html(data);
$("#success").fadeIn();
$("#success").fadeOut(2800);
$("input").val('');
});
$("#rform").submit(function(){
return false;
});
});
});
</script>
Here is the add.ctp code
<?php
echo $this->Form->create('Info',array(
'id' => 'rform'
)); ?>
<fieldset>
<legend><?php echo __('Add Info'); ?></legend>
<?php
echo $this->Form->input('name');
echo $this->Form->input('email');
?>
</fieldset>
<?php
$options = array
(
'label' => 'Add',
'value' => 'Add',
'id' => 'submit'
);
echo $this->Form->end($options);
?>
</div>
<div style="color:green;" id="success">
</div>
Here after add it is repeating insertion page again in bellow.Here I need to show only success massage.If I remove $("#success").html(data); nothing is happening but after insert button name making disappear.How can I add success massage in here ?
I have solved it by little bit change
$("#success").html(data);
to
$("#success").html("Insert Success");
and here I have changed input button tag, I have use direct button here
<button id="submit">Submit </button>

CodeIgniter anchor function without any string in value

My code right now:
<?php echo anchor('admin/delete_msg/'.$obj->id, 'DELETE MESSAGE', array('onclick' => 'return confirm(\'Are you sure?\');', 'class' => 'delete-button')); ?>
But Iwould liek to use something like:
<?php echo anchor('admin/delete_msg/'.$obj->id, '', array('onclick' => 'return confirm(\'Are you sure?\');', 'class' => 'delete-button')); ?>
So there is no "DELETE MESSAGE" text and I can use image instead.
But if I leave the single quotes empty the link will show up e.g. http://localhost/project
Any advice how to solve that within anchor function and not going via <a href="...?
You could use CSS to hide the text and pull in a background image:
.delete-button{
display: inline-block;
width: 80px; /* fits background-img width */
height: 40px; /* fits background-img height */
text-indent: -9999px;
background: url('path/to/image') top left no-repeat;
}
I have solved it using space like:
<?php echo anchor('admin/delete_msg/'.$obj->id, ' ', array('onclick' => 'return confirm(\'Are you sure?\');', 'class' => 'delete-button')); ?>
Don't use the anchor helper. Just pass $obj to the view(html.php)
<a rel="nofollow" onclick="return confirm()" class="btn btn-delete-icon" href="<?php echo site_url('admin/delete_msg/'.$obj->id.'')?>"> </a>

Symfony image button for link_to function

I have a form that when originally submitted, it goes into a page where a user can "preview" the item before posting it to the site. I have these 3 links, but I would like to change it from the default text links to image buttons that they can click on to perform these tasks.
<?php echo link_to('Edit', 'ticket_edit', $ticket) ?>
<?php echo link_to('Purchase', 'ticket_publish', $ticket, array('method' => 'put')) ?>
<?php echo link_to("Cancel", 'ticket_delete', $ticket, array('method' => 'delete', 'confirm' => 'Are you sure you want to delete the item?')) ?>
So instead of "edit", "publish", and "cancel", I want it to display an image for each.
You can use
<?php echo link_to( image_tag( '<your image name>' ), 'ticket_edit', $ticket) ?>
and so on for the other links...
You can use button_to ($name, $internal_uri, $options) (Symfony docs)
<?php echo button_to('Edit', 'ticket_edit', $ticket) ?>
but you cannot use an image as a button. However, this SO answer will give you a function you can use to get what you need.

Resources