Get or read stored cookies valuse and Set or Store Cookies values

Set or Store Cookies values

$value = 'something from somewhere';

setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600);  /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "example.com", 1);

or in Javascript
$.cookie('TestCookie', '1');

Get or read stored cookies valuse

// Print an individual cookie
echo $_COOKIE["TestCookie"];
echo $HTTP_COOKIE_VARS["TestCookie"];

// Another way to debug/test is to view all cookies
print_r($_COOKIE);

Be the first to comment - What do you think?  Posted by admin - April 20, 2012 at 9:54 am

Categories: php guide, php scripts, Session and Cookies in PHP   Tags: , , , ,

Activate Search setting in Drupal

My search text function is not working so I have run cron.php and search is working and resolve the problem

Be the first to comment - What do you think?  Posted by admin - April 5, 2012 at 7:22 am

Categories: Drupal   Tags: , ,

add target blank in primary link in drupal

add following jquery code to your page.tpl.php file in head area
provided that jquery must be run on your machin.

$(document).ready(function(){
$('#id').children(":first").attr("target", "_blank");
});

where #id is your li tag id
if using class instead of #id thene use following line
$('.class').children(":first").attr("target", "_blank");>

Be the first to comment - What do you think?  Posted by admin - March 20, 2012 at 7:55 am

Categories: Drupal, menu   Tags: , ,

Useful Mysql Commands

mysql_insert_id — Get the ID generated in the last query
——–
mysql_connect(‘localhost’, ‘mysql_user’, ‘mysql_password’) – mysql_connect — Open a connection to a MySQL Server
———
mysql_fetch_array — Fetch a result row as an associative array, a numeric array, or both

$result = mysql_query("SELECT id, name FROM mytable");

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("ID: %s  Name: %s", $row[0], $row[1]);
}

————

mysql_fetch_assoc — Fetch a result row as an associative array
Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. mysql_fetch_assoc() is equivalent to calling mysql_fetch_array() with MYSQL_ASSOC for the optional second parameter. It only returns an associative array.

————–

mysql_fetch_field — Get column information from a result and return as an object

————-

mysql_fetch_object — Fetch a result row as an object
Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead.

$result = mysql_query("select * from mytable");
while ($row = mysql_fetch_object($result)) {
echo $row->user_id;
echo $row->fullname;
}

————

Be the first to comment - What do you think?  Posted by admin - February 17, 2012 at 1:39 pm

Categories: MySql   Tags:

Drop Down Menu in Drupal – DHTML Menu

DHTML Menu uses Javascript to reduce the number of page loads when using nested menus; this is particularly useful with Drupal’s administration system.

Download Module

Be the first to comment - What do you think?  Posted by admin - January 19, 2012 at 6:18 am

Categories: menu   Tags: , ,

DRUPAL – Assign different themes for diffent user and node

Taxonomy Theme

Taxonomy Theme allows you to change the theme of a given node based on the taxonomy term or vocabulary.

Download Module

ThemeKey

ThemeKey allows you to define simple or sophisticated theme-switching rules which allow automatic selection of a theme depending on current path, taxonomy terms, language, node-type, and many, many other properties. It can also be easily extended to support additional properties exposed by other modules.

Download Module

Be the first to comment - What do you think?  Posted by admin - January 16, 2012 at 8:51 am

Categories: Error in Drupal, Modules, Theme and Design in Drupal   Tags: , , ,

Metatags not working on Custom content type in Drupal 7

Q -: Metatags works perfectly on the standard Content Type but when I created a content type Custom (Machine name: custom) and created a node–custom.tpl.php not working

Ans -:

Add the following code in custom tpl file which you created for you Content Type. For example include that code in node–custom.tpl.php

render($content['metatags']);

Be the first to comment - What do you think?  Posted by admin - December 22, 2011 at 10:42 am

Categories: Drupal, Drupal 7   Tags: , ,

How to edit head section in Drupal 7

Q -:

In Drupal 6 the entire page data was stored in page.tpl.php. Now, with Drupal 7, only the content that appears in between <body> and </body>. So how do you edit the HEAD info?

 

Ans -:

If the theme you use does not provide the file for the header, it means that Drupal is using the default one, which is now provided by a module called “system”. The file is called html.tpl.php

Just copy this file into your theme, and edit it.

Be the first to comment - What do you think?  Posted by admin - December 21, 2011 at 11:55 am

Categories: Drupal 7   Tags: , ,

Add CAPTCHA to the node add form of a content type

  •     Install and enable the CAPTCHA Module. Probably you also want to enable the image CAPTCHA module or another module that provides a certain challenge type.

 

  •     Configure permissions (admin/user/permissions):

Administer the CAPTCHA module (admin/user/captcha):
Check “Add CAPTCHA administration links to forms”

  •     Add CAPTCHA to a node-add form:

Go to Create Content > [My Content Type] or (node/add/[my_content_type])
Click on “CAPTCHA: no challenge enabled”
On new page “CAPTCHA point administration” select a challenge type > Save

  •     Return to CAPTCHA admin page (admin/user/captcha), refresh, and notice new entry in the Form Protection section [my_content_type_node_form]

 

Be the first to comment - What do you think?  Posted by admin - December 12, 2011 at 6:42 am

Categories: Captcha, Drupal   Tags: , ,

Resolve clean url problem in Drupal with IIS Server

If you getting problem to apply clean url on IIS Hosting then post this given code in web.config file its hope will be resolve

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”Drupal Clean URLs” stopProcessing=”true”>
<match url=”^(.*)$” />
<conditions>
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />
<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />
</conditions>
<action type=”Rewrite” url=”index.php?q={R:1}” appendQueryString=”true” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Be the first to comment - What do you think?  Posted by admin - November 20, 2011 at 7:33 am

Categories: error in drupal, Error in Drupal   Tags: , ,

Next Page »