How to turn off the caching functionality in smarty - caching

I want to turn-off caching functionality in smarty. I have tried using the following code
$smarty->caching = true;
$smarty->cache_lifetime = 120;
But the above code would not work.
How can i turn-off caching.
Thanks in Advance !!

If you want to turn it off, you need to set:
$smart->caching = Smarty::CACHING_OFF;
and not
$smarty->caching = true;
as you showed in your question

Related

Is there any way to set options in beautify extension for Ace Editor?

I've found the beautify extension in Ace editor but I don't see any examples of how to use it. Is there a way to set any options?
Example what I have so far:
var beautiful = ace.require("ace/ext/beautify"); // get extension
var editor = ace.edit("editor"); // reference to our editor
editor.setValue(someCode); // add some code to the editor
beautiful.beautify(editor.session); // beautify the code
When I call this method the code is formatted but it is all unindented / outdented all the way to the left and some spaces are removed. It doesn't look quite right. So I want to know if there are any options. I looked at the code but it is minified. Which is why I'm asking this question here.
Before call:
After call:
UPDATE:
I found an unminifed copy of the extension. It looks like there are no options and it looks like it only works for PHP:
exports.beautify = function(session) {
var iterator = new TokenIterator(session, 0, 0);
var token = iterator.getCurrentToken();
var context = session.$modeId.split("/").pop();
var code = phpTransform(iterator, context);
session.doc.setValue(code);
};
I did not find any options in the beautify.js code for the beautify() method. I found a comment saying that it is not being worked on or supported any more. I do not have the source but it said it was not working and was then abandoned.
It might work alright for JavaScript but is not working well for ActionScript.

How can I set Fullcalendar options dynamically

How can I set the minTime and maxTime options after the calendar is created?
I tried the following, which doesn't work:
$('#calendar').fullCalendar('option', 'minTime', 7);
$('#calendar').fullCalendar('render');
I don't know if it is still relevant but I can change the options with the following statement:
example for selectable:
$('#calendar').fullCalendar('getView').calendar.options.selectable = false;
$('#calendar').fullCalendar('render'); // rerender to see visual changes
Though it's not dynamically but at least you don't have to destroy the whole calendar and refetch your events :-)
This way you can change as many calendar options you like:
// save the calendar options in a variable
var calendarOptions = $('#calendar')
.fullCalendar('getView')
.options;
// make your changes to the calendar options
// I wanted to change the slotDuration
calendarOptions.slotDuration = '00:20:00';
// destroy the calendar
$('#calendar')
.fullCalendar('destroy');
//Lets load the calendar with the new options
$('#calendar')
.fullCalendar(calendarOptions);
Hope this helps. Thanks.
This functionality has been officially release in v2.9.0: http://fullcalendar.io/docs/utilities/dynamic_options/
Can't be done without recreating the calendar.
Update:
Can be done in v 2.9: See below
There's an open issue for this functionality here:
https://code.google.com/p/fullcalendar/issues/detail?id=293
just me dude's answer is actually the only way I found myself.
This is just an addendum to this former answer :
If you want to change the editable option, which is very useful if you want to lock the events for asking confirmation on a change before updating your database, it's a little more tricky. In case it can save some time to someone I dump the code:
var view = $('#calendar').fullCalendar('getView');
view.calendar.options.editable = false;
view.calendar.overrides.editable = false;
view.calendar.viewSpecCache.month.options.editable = false;
view.calendar.viewSpecCache.agendaWeek.options.editable = false;
view.calendar.viewSpecCache.agendaDay.options.editable = false;
$('#calendar').fullCalendar('render');
You obviously change all those false to true to unlock.
This code just did fine for me. Call this function anywhere and pass as many custom variables to it, but don't forget to destroy the previous calendar first
function initializeCalendar( timeIntervalCustom ) {
$('#calendar'+id).fullCalendar({
slotMinutes: timeIntervalCustom,
});
}
$('#calendar').fullCalendar("destroy");
initializeCalendar(10);

jsplumb library getconnection function is not returning values

Hi all I am working in JS plumb library for making connections.I am stuck at one point and need help from experts.
Here is my scenario.
I have many connections and what I want is that when I click on one connection a certain label appears on it to show that it is selected.When I click one some other connection previously clicked connection disappears and new connection get selected.
What I have done so far is that
jsPlumbInst.bind('click', function(c) {
c.showOverlay('selected');
var previously_active = jsPlumbInst.getConnections({scope:"active"});//this function not returning me values
if(previously_active.length != 0) {
/*So never go in this statement*/
previously_active[0].hideOverlay('selected');
previously_active.scope("jsPlumb_DefaultScope");
}
c.scope = "active";
});
Here the problem is that my connection scope is set to "active"
jsPlumbInst.getConnections({scope:"active"})
is not returning anything.
So can any one kindly guide me that whether I am doing right?
Or is there any other way to achieve this?
var sourcecon = jsPlumb.getConnections({source: e}) ;
for(i=0; i<sourcecon.length; i++)
{
var target = getName(sourcecon[i].targetId) ;
var source = getName(sourcecon[i].sourceId) ;
removefrommatrix(source, target,sourcecon[i].sourceId,sourcecon[i].targetId) ;
}
This is code snippet which I am using. It works fine. Your code looks fine except just one difference that you have used jsPlumbInst rather than jsPlumb. I guess that could be the problem. For me its like static class in Java.Not sure about that. But try and see if it could help you.Seems like I am almost a year late in replying. All the best :-)

event listener in jquery for variable change

I want to track a variable as I navigate around my site. How can I use jQuery to output this value without having to worry about tracking down wherever it might be affected and having it update.
var num = 1;
$(#trackvariable).text(num)
I want the above to execute constantly as it were.. I don't necessarily want to do it on a timer. Is there any way to do that?
If you want to listen to changes on a textnode, you can do something like this:
function InitListener () {
var container = document.getElementById ("textContainer");
var textNode = container.firstChild;
if (textNode.addEventListener) {
textNode.addEventListener ('DOMCharacterDataModified', OnCharacterModified, false);
}
}
This will only work in Firefox (and probably Chrome in Safari also):
https://developer.mozilla.org/en/JavaScript/Guide/Working_with_Objects#Defining_Getters_and_Setters
Off the top of my head I would say that the functions changing the variable should just call some sort of update function at the end of them? just an idea. I think even if you set up some kind of custom event it would still have to manually triggered in each function.

jqGrid tree grid with pager

How do we make a tree grid with pager using jqGrid?
I have checked and try the demos, but it didn't show any pager, even though there is a pager div in the code
How do create the pager ?
Tree grid has some limitations which are documented:
Pager functionality currently disabled
for treeGrid
In other place of the documentation you can read almost the same:
Since jqGrid currently does not
support paging, when we have a
treegrid the pager elements are
disabled automatically.
I got pagination to work by modifying the setTreeGrid function. I commented out the following line:
$t.p.pgbuttons = false;$t.p.pginput = false;
The buttons then appeared and the requests were going back to the server to request the information. Now for this I was loading the entire tree to a local variable then using setJSONData to load the data into the tree. It functions the way I would expect it to but I haven't thoroughly tested it.
For RowList
$t.p.multiselect = false;$t.p.rowList = [10,15,20,30];
Try change d.p.pgbuttons = !1; to d.p.pgbuttons = !0; AND d.p.pginput = !1; to d.p.pginput = !0; AND d.p.rowList = []; to d.p.rowList = [10,50,100]; in block setTreeGrid: function () {...}
According to "New functional for treeGrid" Vyacheslav N. Boyko added this feature to jqGrid.And there is a open issue that demands to apply this feature to jqGrid.

Resources