Friday, August 30, 2013

List of all RSS tags that can be applied

ElementDescription
<author>Specifies the email address of the author of an RSS item.
<category>Specifies a category for an entire RSS feed or for individual RSS items.
<channel>Required. Describes an RSS feed with a title, description, and a URL where the RSS can be found.
<cloud>Sets up processes that are automatically notified when a feed has been updated.
<comments>Specifies a URL where comments about an RSS item can be found.
<copyright>Sets copyright information for an RSS feed.
<description>Required. Sets a description for an RSS feed/item.
<docs>Specifies a URL where the documentation for the RSS version used in the RSS file can be found.
<enclosure>Specifies a media file to be included with an RSS item.
<generator>Specifies the program used to create your RSS feed.
<guid>Stands for Globally Unique Identifier. Sets a string that uniquely identifies an RSS item.
<image>Specifies an image to be displayed with an RSS feed (must be gif, jpeg, or png).
<item>Required. Sets items in an RSS feed.
<language>Specifies the language your RSS feed is written in.
<lastBuildDate>Specifies the most recent time the content of an RSS feed was modified.
<link>Required. Specifies the URL where an RSS feed/item content can be found.
<managingEditor>Specifies the email address of the editor of the content of the feed.
<pubDate>Specifies the publication date for an RSS feed/item.
<source>Specifies the source of an RSS item (if it came from another RSS feed)
<skipDays>Specifies the days of the week when feed readers should not update an RSS feed.
<skipHours>Specifies the hours of the day when feed readers should not update an RSS feed.
<textInput>Specifies a textbox to be displayed with an RSS feed.
<title>Required. Sets the title of an RSS feed/item.
<ttl>Stands for Time To Live. Specifies how many minutes your RSS feed can stay cached before it is refreshed.
<webMaster>Specifies the email address of the webmaster of an RSS feed.

Joomla find current page URL with query string

$uri = & JFactory::getURI();
$pageURL = $uri->toString();
echo $pageURL;


This will find the absolute path, but will not fetch query string
$pageURL = JURI::current();
echo $pageURL;


Thursday, August 8, 2013

Find whether the element in in array JQuery

Use jQuery inArray function

jQuery.inArray('value_to_find', array_var);

Delete a specific element in Javascript Array

TO delete a particular element in javascript array, find the index of that element and the use splice method

For example:

var sample_array = ['one', 'two', 'three'];
var index = sample_array.indexOf(id);
sample_array.splice(index, 1);

Note ; Splice method can be used other different cases of accessing and deleting element with help of parameters. Refer Splice() reference.

Create a Cookie in Javascript

Create a cookie in javascript

document.cookie="unCheckedIds="+c_ids+";path=/";

Here unCheckedIds is the name of the Cookie and c_ids will have the value of the Cookie. Path "\" is used to use the cookie in the domain level and not for the page level.

If path is not given, by default it will opt for page level.

Other parameters like path are expiry and domain.

Get a Cookie in Javascript

This function will return a cookie saved. Just call this function with the name of a cookie as a parameter.


function getCookie(c_name)
    {
        var c_value = document.cookie;
        var c_start = c_value.indexOf(" " + c_name + "=");
        if (c_start == -1)
        {
            c_start = c_value.indexOf(c_name + "=");
        }
        if (c_start == -1)
        {
            c_value = null;
        }
        else
        {
            c_start = c_value.indexOf("=", c_start) + 1;
            var c_end = c_value.indexOf(";", c_start);
            if (c_end == -1)
            {
                c_end = c_value.length;
            }
            c_value = unescape(c_value.substring(c_start,c_end));
        }
        return c_value;
    }     

Find Children of a Class or ID

To find the children of a a specific div or any class or ID in jQuery

trs = $('#jevents_body').find('table.day-list > tbody > tr');

Joomla JEvents Category Filtering

(function ($){
 var ready = (function(){
  setUpCalModule();
 });


 // events calendar category checkbox filtering
 var setUpCalModule = (function(){
   var left, trs;
   left = $('.content-area-left').children('.moduletable');
   if (!left.length) return;

   trs = $('#jevents_body').find('table.day-list > tbody > tr');

   left.on('change','#jevent-mod-cat-checks', function(){
     var checks = $(this).find('input[type="checkbox"]'),
 checked = checks.filter(':checked'),
 notChecked = checks.not(checked);

     checked.each(function(){
      deleteCookieValue(this.value);
trs.filter('[data-cat="'+this.value+'"]').show();
     });

     notChecked.each(function(){
      setCookie(this.value);      
trs.filter('[data-cat="'+this.value+'"]').hide();
     });

   });
 });

 // get ready ... go!
 jQuery(document).ready(ready);

})(jQuery);