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);
My search text function is not working so I have run cron.php and search is working and resolve the problem
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");>
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;
}
————
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
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
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']);
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.
- 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]
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>