1.Aggregator module for RSS feeds
we have drupal core module aggregator module and enable it,then goto content management+feed aggregator then add category
+
then click on add feed ( u have to slect the category which is created earlier)+click on "update items".
If you want to give the menu link means just click on category name link , give that path to menu path
If you want to give the menu link means just click on category name link , give that path to menu path
.................
So finally U can able to create menu link and Block for Above created feed. Notice that u can see in blocks for particular category feed......
2.How to enable clean urls?
when ever clean url's not enabled
1.go to site config ->clen url's , put 'Enable'
2.Go to apache- httpd.config then just enable the 'mod_rewrite', (means just add the #)
in this above two casses clean url/s will come surly but incase clean url's will come and they are not working means
A) go to httd.config , it should not be in hide i.e file permissinos must be read and write..
Search for
#
# This should be changed to whatever you set DocumentRoot to.
#
and change "AllowOverride None" to "AllowOverride All".
3.How to send the Scripts/styles from header to footer?
Actually above task should help for the increase the spead the site
so..........
Goto our theme then page.tpl.php
in this cut the <?php print $styles ?> in the header and paste into footer
in this cut the <?php print $styles ?> in the header and paste into footer
4.How to get the meomary allocation while we get the fatal error?
GO TO C:\WAMP\www\drupalpractice\sites\default/settings.php
add following line
ini_set('memory_limit', '128M');
5.How to get the " more" or "Read More" option for our content with views in drupal?
First thing is add node +nid fileld and put this filed to exclude from display and put n this field in top, then add "Global" in that in "Text" write wt do u want means More or read more then Click on "output this field as a link" put "node/[nid]"then Save it..
For o/p watch http://www.kondalu.com/framework or www.kondalu.com
Thats it for today ...Have a Nice day....
6.Blogs
we have core-optional Blog and download advanced Blog Modules.then automatically we have content type Blog Entry ,(in case u need more fields with this content type . add it,This is up to u)...then its over ,of course u need menu link for this , in path of primary link just put"blog"..Thats it...
Ho... incase u have dought how to add the Bloggers (users means admin,ravikarnatiphp) and recent Blog posts ...simple thing yahr... automatically they should come as a Block., go to block and put it in which place do u want... Hurryyyyyyyyyyy
7.Forums
U need to download "Advanced forum " module ..Thats it ..over.. why are u loooking with crying face....remaining as like as above..What a smiley face from uuuuuuuuu..keep it up
8.Groups
U need to download "Organic group " module ..Thats it ..over.. why are u looking again with crying face....remaining as like as above..What a smiley face from uuuuuuuuu..keep it up
9.How to get the Single image as a Block for whole content gallery?
Simple in views just put 1 in "Items dispaly"
10.Quiz Module
Download Quiz module , go to create content for''Quiz", gives title, and incase u nedd menu link for this click on "Menu settings" then save then click on which type quiz u want , then fill the questions and answers for ur selected type.. thats it.. u click on menu link what u give before means u will see quiz , for settings for this module goto "site configuration"
11.How to add the Embedded you tube video to our site?
Very simple .. but u need to install the embeded media field and youtube modules , goto what you tube video u want and copy the embedded code then goto in body of ur content just paste the embedded code ,over, of course u can adjust height and width of video in embedded code
5.How to get the " more" or "Read More" option for our content with views in drupal?
First thing is add node +nid fileld and put this filed to exclude from display and put n this field in top, then add "Global" in that in "Text" write wt do u want means More or read more then Click on "output this field as a link" put "node/[nid]"then Save it..
For o/p watch http://www.kondalu.com/framework or www.kondalu.com
Thats it for today ...Have a Nice day....
6.Blogs
we have core-optional Blog and download advanced Blog Modules.then automatically we have content type Blog Entry ,(in case u need more fields with this content type . add it,This is up to u)...then its over ,of course u need menu link for this , in path of primary link just put"blog"..Thats it...
Ho... incase u have dought how to add the Bloggers (users means admin,ravikarnatiphp) and recent Blog posts ...simple thing yahr... automatically they should come as a Block., go to block and put it in which place do u want... Hurryyyyyyyyyyy
7.Forums
U need to download "Advanced forum " module ..Thats it ..over.. why are u loooking with crying face....remaining as like as above..What a smiley face from uuuuuuuuu..keep it up
8.Groups
U need to download "Organic group " module ..Thats it ..over.. why are u looking again with crying face....remaining as like as above..What a smiley face from uuuuuuuuu..keep it up
9.How to get the Single image as a Block for whole content gallery?
Simple in views just put 1 in "Items dispaly"
10.Quiz Module
Download Quiz module , go to create content for''Quiz", gives title, and incase u nedd menu link for this click on "Menu settings" then save then click on which type quiz u want , then fill the questions and answers for ur selected type.. thats it.. u click on menu link what u give before means u will see quiz , for settings for this module goto "site configuration"
11.How to add the Embedded you tube video to our site?
Very simple .. but u need to install the embeded media field and youtube modules , goto what you tube video u want and copy the embedded code then goto in body of ur content just paste the embedded code ,over, of course u can adjust height and width of video in embedded code
12.Ubercart module for E-commerce site?
download it and enable it, we can get the "store administraion" in 'site configuration', change the settings as like u then ""create content" as a "product" or 'product kit', so finally u can get menu link using this content and finally 1 word, u can also have the Block for this module
Releted modules are -Ubercart auction, uber pos, E-commerce,shopping cart
13.How to put a link using views?
In views,of content ,select"output this field as a link", in link path "" field-url-value"
14.Which are the core required modules in drupal 6.x ?
1. Block --- Controls the boxes that are displayed around the main content.
2. Filter --- Handles the filtering of content in preparation for display.
3. Node --- Allows content to be submitted to the site and displayed on pages.
4. System --- Handles general site configuration for administrators.
5. User --- Manages the user registration and login system
15.Module development Reference sites?
http://public-action.org/content/drupal-beginners-programming-creating-simple-drupal-module-files-and-directories
http://drupal.org/node/206753
http://drupal.org/node/206759
http://api.drupal.org/api/drupal/includes--module.inc/group/hooks/6
http://drupal.org/node/204270
http://drupal.org/node/262422
16.How to administrator log-in to drupal site when ever administrator disable the ""log-in " block , and present in log-out situvation?
simple put "user/login" followed by our site
exapmle:http://www.chilukurubalajitemple.com/user/login
general formate: http://www.chilukurubalajitemple.com/admin (while we have "user login" block)
17.Useful modules or extensions list ?
21.What is the difference between loadObjectList and loadResult?
1.loadObjectList returns the result in object format means while we print the output using this
<?php echo $lists->title ; ?>
2.loadResult returns the result in array format while we print the output using this
<?php echo $list[title]; ?>
we need to print the key value , here title is key value of array
22.Importent modules for Image and video fields for CCK?
Filefield,image field,embeded media field,upload(core)
23.what are modules for date and calnder in CCK?
date and calender.
24.what are modules for google map in CCK?
Location, Google map
25. what is the module for Rating in CCK?
Voting API + Five star
26.Drupal theme Guide link?
http://drupal.org/node/171194
http://206.47.151.134/openpublish/?q=admin
28.How can i embeded the Views to the blocks?
By using views_embed_view() method
Ref link: http://ericlondon.com/embedding-view-drupal-6-using-views-embed-view
ex:
$viewName = 'issues_right_date_views_fields';
$display_id = 'block_1';
$myArgs = arg(1);
$views= views_embed_view($viewName, $display_id, $myArgs);
$output.="<p>".$views." </p>";
/**
* Implementation of hook_block().
*/
function custom_openpublish_block($op = 'list', $delta = 0) {
$block = array();
switch ($op) {
case 'list':
$block[0]['info'] = t('Molecular Image');
$block[1]['info'] = t('Subscribe Image');
$block[2]['info'] = t('Molecular statistics');
$block[3]['info'] = t('Issues Top');
$block[4]['info'] = t('Tools');
return $block;
case 'view':
switch ($delta) {
case 0:
$block['subject'] = t('Molecular Image');
$block['content'] = get_mi_image();
break;
case 1:
$block['subject'] = t('Molecular Image1');
$block['content'] = get_subscribe_image();
break;
case 2:
$block['subject'] = t('Molecular statistics');
$block['content'] = get_statistics();
break;
case 3:
$block['subject'] = t('Issues Top');
$block['content'] = "<div class='block2'>
<p class='texttype2'><a href='?q=user/login'>Login</a> | <a href='?q=user/register'>Register</a></p>
<p>Login to an existing account or Register a new account.</p>
<p class='texttype2'>Purchase this article for 35.00 USD <span>(You must login/register to purchase this article) <br>
Online access for 24 hours. The PDF version can be downloaded as your permanent record.</span></p>
<p class='texttype2'><a href='#'>Subscribe to this title</a></p>
<p>Get unlimited online access to this article and all other articles in this title 24/7 for one year.</p>
<p class='texttype2'><a href='#'>Claim access now</a></p>
<p>For current subscribers with Society Membership or Account Number.</p>
</div>";
break;
case 4:
$block['subject'] = t('Tools Bottom');
$block['content'] = "<p class='title2'>Tools</p>
<div class='block4'>
<ul>
<li><a href='#'><img alt='' src='sites/all/themes/MOLECULAR/images/iocn-tools-1.gif'>Send Abstract</a></li>
<li><a href='#'><img alt='' src='sites/all/themes/MOLECULAR/images/iocn-tools-2.gif'>Download PDF Copy</a></li>
<li><a href='#'><img alt='' src='sites/all/themes/MOLECULAR/images/iocn-tools-3.gif'>Rights & Permissions</a></li>
<li class='last'><a href='#'><img alt='' src='sites/all/themes/MOLECULAR/images/iocn-tools-4.gif'>Request Reprints</a></li>
</ul>
</div>"
;
break;
}
return $block;
}
} // end function fightfi_block
<br />
Note: node_gallery is ur module name
2. Filter --- Handles the filtering of content in preparation for display.
3. Node --- Allows content to be submitted to the site and displayed on pages.
4. System --- Handles general site configuration for administrators.
5. User --- Manages the user registration and login system
15.Module development Reference sites?
http://public-action.org/content/drupal-beginners-programming-creating-simple-drupal-module-files-and-directories
http://drupal.org/node/206753
http://drupal.org/node/206759
http://api.drupal.org/api/drupal/includes--module.inc/group/hooks/6
http://drupal.org/node/204270
http://drupal.org/node/262422
16.How to administrator log-in to drupal site when ever administrator disable the ""log-in " block , and present in log-out situvation?
simple put "user/login" followed by our site
exapmle:http://www.chilukurubalajitemple.com/user/login
general formate: http://www.chilukurubalajitemple.com/admin (while we have "user login" block)
17.Useful modules or extensions list ?
DEFAULT MODULES (OTHER):
CKEditor,DHTML Menu,Flowplayer API(videos),IMCE,Taxonomy List,Thickbox
NEED TO DOWNLOAD:
Taxonomy Menu,Video,views(Views Carousel,Views exporter,Views Rotator,Views
Slideshow, thickbox,Views Slideshow SingleFrame,Views Slideshow ThumbnailHover),WEBFORM,PANESL,Administrator menu,Gallery assist,Admin menu or root candy,
CKEditor,DHTML Menu,Flowplayer API(videos),IMCE,Taxonomy List,Thickbox
NEED TO DOWNLOAD:
Taxonomy Menu,Video,views(Views Carousel,Views exporter,Views Rotator,Views
Slideshow, thickbox,Views Slideshow SingleFrame,Views Slideshow ThumbnailHover),WEBFORM,PANESL,Administrator menu,Gallery assist,Admin menu or root candy,
18.How can we create the stylesheet for particulr view induvally or how can we write the styles in views?
Go to particulr view what u neeed to style,in that we have a option in left side "Theme" of "Basic settings", in that "theme",click on "information", u can see the "display layout" , in that second name is what? that is with ur content type, right? yes is ur answer, copy that name , and go to ur froent end theme folder, in that root folder create one php file with the what u had copied name... then back to views in administration, click on "display output",php code may come, copied that php code and paste in to ur new created php file, and write the styles in it. thts it...
19.How to get the Ck editor in drupal 6?
Download "ck editor" and "imce" ,put this in sites->all->modules and download 'wysiwyg', and put this in sites->all->libraries, go to "Site permissions", and check mark to first two , then go to 'wysiwyg profiles' , click on "filtered html " and "fullhtml" , in both condtions select ck editor....if u want get the file upload option in body part then go to "site config"->ckeditor->imce in default and 'advance' of 'file form settings'.
20.How to put a link to one field in views?
in views , go to that field,watch "out put this field as a link", in link path put 'field-url-value'21.What is the difference between loadObjectList and loadResult?
1.loadObjectList returns the result in object format means while we print the output using this
<?php echo $lists->title ; ?>
2.loadResult returns the result in array format while we print the output using this
<?php echo $list[title]; ?>
we need to print the key value , here title is key value of array
22.Importent modules for Image and video fields for CCK?
Filefield,image field,embeded media field,upload(core)
23.what are modules for date and calnder in CCK?
date and calender.
24.what are modules for google map in CCK?
Location, Google map
25. what is the module for Rating in CCK?
Voting API + Five star
26.Drupal theme Guide link?
http://drupal.org/node/171194
27.what is non seo link?
http://206.47.151.134/openpublish/?q=admin
28.How can i embeded the Views to the blocks?
By using views_embed_view() method
Ref link: http://ericlondon.com/embedding-view-drupal-6-using-views-embed-view
ex:
$viewName = 'issues_right_date_views_fields';
$display_id = 'block_1';
$myArgs = arg(1);
$views= views_embed_view($viewName, $display_id, $myArgs);
$output.="<p>".$views." </p>";
29.Write the simple block development?
/**
* Implementation of hook_block().
*/
function custom_openpublish_block($op = 'list', $delta = 0) {
$block = array();
switch ($op) {
case 'list':
$block[0]['info'] = t('Molecular Image');
$block[1]['info'] = t('Subscribe Image');
$block[2]['info'] = t('Molecular statistics');
$block[3]['info'] = t('Issues Top');
$block[4]['info'] = t('Tools');
return $block;
case 'view':
switch ($delta) {
case 0:
$block['subject'] = t('Molecular Image');
$block['content'] = get_mi_image();
break;
case 1:
$block['subject'] = t('Molecular Image1');
$block['content'] = get_subscribe_image();
break;
case 2:
$block['subject'] = t('Molecular statistics');
$block['content'] = get_statistics();
break;
case 3:
$block['subject'] = t('Issues Top');
$block['content'] = "<div class='block2'>
<p class='texttype2'><a href='?q=user/login'>Login</a> | <a href='?q=user/register'>Register</a></p>
<p>Login to an existing account or Register a new account.</p>
<p class='texttype2'>Purchase this article for 35.00 USD <span>(You must login/register to purchase this article) <br>
Online access for 24 hours. The PDF version can be downloaded as your permanent record.</span></p>
<p class='texttype2'><a href='#'>Subscribe to this title</a></p>
<p>Get unlimited online access to this article and all other articles in this title 24/7 for one year.</p>
<p class='texttype2'><a href='#'>Claim access now</a></p>
<p>For current subscribers with Society Membership or Account Number.</p>
</div>";
break;
case 4:
$block['subject'] = t('Tools Bottom');
$block['content'] = "<p class='title2'>Tools</p>
<div class='block4'>
<ul>
<li><a href='#'><img alt='' src='sites/all/themes/MOLECULAR/images/iocn-tools-1.gif'>Send Abstract</a></li>
<li><a href='#'><img alt='' src='sites/all/themes/MOLECULAR/images/iocn-tools-2.gif'>Download PDF Copy</a></li>
<li><a href='#'><img alt='' src='sites/all/themes/MOLECULAR/images/iocn-tools-3.gif'>Rights & Permissions</a></li>
<li class='last'><a href='#'><img alt='' src='sites/all/themes/MOLECULAR/images/iocn-tools-4.gif'>Request Reprints</a></li>
</ul>
</div>"
;
break;
}
return $block;
}
} // end function fightfi_block
30.Drupal form and module programming example?
http://public-action.org/content/drupal-beginners-programming-create-simple-drupal-module-use-form-api-completing-code
http://www.devdaily.com/drupal/drupal-form-module-programming-examples-tutorials
http://www.kpbowler.co.uk/drupal-forms
31.How can use the Gmail as SMTP and its config details?
http://lifehacker.com/111166/how-to-use-gmail-as-your-smtp-server
32.List of Used modules in Real time?
1.mediafront ( vedio galley module with osm player)
2.jcaresol lite(image gallery module)
3.Node gallery (image Gallery module)
4.Auto Node title
5.Node clone ( copy of node)
6.DD block( Home page slideshow with images, node title, Node intro text)
6.Node privacy by role: access to individual nodes and is so easy to use.
5.Node clone ( copy of node)
6.DD block( Home page slideshow with images, node title, Node intro text)
6.Node privacy by role: access to individual nodes and is so easy to use.
33.Facebook Integration code?
<p><iframe allowtransparency="true" border-radius:5px="" frameborder="0" scrolling="no" src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2FASAEntertainment&width=300&height=283&colorscheme=light&show_faces=true&border_color&stream=false&header=true" style="border: medium none; overflow: hidden; width: 300px; background-color: white; height: 288px; margin-top: -10px; font-size: 11px; border:6px solid #808080;border-radius:5px;"></iframe></p>
34.Twitter Integration code?
<br />
<script src="http://widgets.twimg.com/j/2/widget.js"></script><script>
new TWTR.Widget({
version: 2,
type: 'list',
rpp: 20,
interval: 30000,
title: '',
subject: 'ASA on Twitter',
width: 300,
height: 210,
theme: {
shell: {
background: '#808080',
color: '#ffffff',
},
tweets: {
background: '#ffffff',
color: '#444444',
links: '#5340c2'
}
},
features: {
scrollbar: true,
loop: false,
live: false,
behavior: 'all'
}
}).render().setList('asaworldtour', 'asa-entertainment').start();
</script>
<style type="text/css">
.twtr-doc{height:298px; margin-top:-10px; border-radius:none; }</style>
35.Using Drupal Views Arguments to Show Results Only When a Filter is Used?
http://highrockmedia.com/blog/using-drupal-views-arguments-show-results-only-when-filter-used
36.How can we the know the database name of drupal project using files ?
Go to settings.php
36.How can we know the form id in drupal?
go to tour " .module " file in ur module , then u have hook_form _alter function in that add below line in that function
echo $form_id;
exit;
37.How can u get the values of expopsed filter form in drupal?
function node_gallery_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'views_exposed_form'){
$view = &$form_state['view'];
echo ($form_state['input']['tid']);
echo ($form_state['input']['tid_1']);
echo ($form_state['input']['tid_2']);
// OR
echo ($view->exposed_input['tid']);
echo ($view->exposed_input['tid_1']);
echo ($view->exposed_input['tid_2']);
}
}
36.How can we the know the database name of drupal project using files ?
Go to settings.php
36.How can we know the form id in drupal?
go to tour " .module " file in ur module , then u have hook_form _alter function in that add below line in that function
echo $form_id;
exit;
37.How can u get the values of expopsed filter form in drupal?
function node_gallery_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'views_exposed_form'){
$view = &$form_state['view'];
echo ($form_state['input']['tid']);
echo ($form_state['input']['tid_1']);
echo ($form_state['input']['tid_2']);
// OR
echo ($view->exposed_input['tid']);
echo ($view->exposed_input['tid_1']);
echo ($view->exposed_input['tid_2']);
}
}
Note: node_gallery is ur module name
38.How can we put the More link along with body exactly?
create view tpl file with body for example 'view-view-field--latestheadlines-body.tpl.php', here latestheadlines is the view name , and put the following code in that tpl file..
<?php
// First of all create a teaser version of the body field
$teaser = node_teaser($output);
// show the teaser on the page
print $teaser;
// now below compare the teaser to the original full field, and if it's different, show a more link
if ($teaser == $output) {
print l('MORE', drupal_get_path_alias('node/'.$row->nid),array('attributes' => array('class' => 'moreTeaserLink')));
}
?>
39.How to create a multi site?
1.create one folder with 'sites' floder what name u want for multi site, in that the folders need to create , they are modules, themes, files, settings.php,
2.for settings.php we need to create one database and need to give that name in '$db-url ' in settings.php of multi site.
ex: $db_url = 'mysql://root:Inkriti-321@localhost/asa';
in above root is database username, Inkriti-321 is the database or mysql root password , (in live site we must give the my sql root password for this) , asa is the database name.
3. in httd.conf file we need to search for 'alias' module in that we need to add the one line
for example: in localhost: Alias/2010/events/Megaramp "C/wamp/www"
in Live server : Alias/2010/events/Megaramp "/usr/local/apache2/htdocs"
i.e '/usr/local/apache2/htdocs' is the path to main site as per FTP
4.in .htaccess file we need to fine out the 'IFMODULE'' add the following lines
the following is the full code
<IfModule mod_rewrite.c>
RewriteEngine on
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
RewriteBase /
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/2010/events/megaramp/(.*)$
RewriteRule ^(.*)$ /2010/events/megaramp/index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/asaevents/(.*)$
RewriteRule ^(.*)$ /asaevents/index.php?q=$1 [L,QSA]
</IfModule>
http://drupal.org/node/717750
http://groups.drupal.org/node/20384
42.How can we theme a node?
http://www.caucusllc.com/blog/theming-a-cck-node
http://thanhsiang.org/faqing/node/96
http://hankpalan.com/blog/drupal-themes/theming-node-drupalthe-easy-way
for drupal 7: http://robotlikehuman.com/web/printing-cck-content-field-values-drupal-7
for body :<?php
print $node->content['body']['#value']
?>
for field : <?php print $node->field_attorneyimage[0]['view']; ?>
<?php print $node->field_firstname[0]['view']; ?>
43.How can we add the div style to the drupal form?
. Define a theme override function within your custom module as follows:
44.what did you do when ever u upload to live site from localhost then empty blank page will come when ever u save or submit button?
http://drupal.org/node/158043
http://drupal.org/node/31819
http://amiworks.co.in/talk/the-white-screen-of-death/
http://devbee.com/dreaded_blank_page_of_death
http://forum.werockyourweb.com/drupal/drupal-blank-page-after-submit
45.How to diasable the errors from front end?
go to site config+'error reporting ', put option is 'write errors to the log.'
46.headers alredy sent error?
http://www.2by2host.com/articles/cannot-modify-header-information/
OR
goto 'your site/includes/common.inc'
delete this code
header($header);
$stored_headers[] = $header;
from
if (strlen($header)) {
header($header);
$stored_headers[] = $header;
}
return implode("\n", $stored_headers);
}
47.Image upload error in while uploading in live site?
http://drupal.org/node/810882
48.Time zone error in live site?
http://vsingleton.blogspot.in/ 2010/01/you-are-required-to- use-datetimezone.html
49.How to change the text of default value (-Any-) of an exposed filter in drupal views?
see this link
http://stackoverflow.com/questions/4668266/how-to-change-the-label-of-the-default-value-any-of-an-exposed-filter-in-dru
or write this code in .module file
<?php
function attorneyes_form_alter(&$form, $form_state, $form_id) {
if($form_state['view']->name == 'Advanced_Search') {
$form['tid_1']['#options']['All'] = t('Practice Area');
$form['tid']['#options']['All'] = t('Position');
$form['tid_2']['#options']['All'] = t('Office');
}
}
?>
49.How to change the text of default value (-Apply-) of an Submit button in drupal views?
see this link
http://stackoverflow.com/questions/4668266/how-to-change-the-label-of-the-default-value-any-of-an-exposed-filter-in-dru
or write this code in .module file
<?php
function attorneyes_form_alter(&$form, $form_state, $form_id) {
if($form_state['view']->name == 'Advanced_Search') {
$form['submit']['#value'] = t('Ravi');
}
}
?>
51.How to change the text with jquery?
$("#views-exposed-form-tree-info-articles-list-page-1 #edit-tid option:first").text("All");
52.How can we add the add the tabs to the node ?
use the following modules
1.CCK Fieldgroup Tabs
2. tabs
incase tabs are not visible after confiog , just diasble the 'Jquery-UI' module
53.how to theme the tabs in custom node tpl.php or corrct code to include the tabs in custom tpl.php?
http://drupalsn.com/learn-drupal/drupal-tutorials/fancy-select-menus-drupal-using-jquery
55.How can we enable the block for one individual content type all pages?
content/news/* or news/* (Depends on url is generating for node page i.e in node page url contains 'content' means first one need to put, otherwise second one)
56.How to create the phpinfo.php file and which code need to write?
Just go to your root folder and create one php file with name called 'phpinfo.php' and place this code in to that file...
<?php
phpinfo();
?>
2.for settings.php we need to create one database and need to give that name in '$db-url ' in settings.php of multi site.
ex: $db_url = 'mysql://root:Inkriti-321@localhost/asa';
in above root is database username, Inkriti-321 is the database or mysql root password , (in live site we must give the my sql root password for this) , asa is the database name.
3. in httd.conf file we need to search for 'alias' module in that we need to add the one line
for example: in localhost: Alias/2010/events/Megaramp "C/wamp/www"
in Live server : Alias/2010/events/Megaramp "/usr/local/apache2/htdocs"
i.e '/usr/local/apache2/htdocs' is the path to main site as per FTP
4.in .htaccess file we need to fine out the 'IFMODULE'' add the following lines
the following is the full code
<IfModule mod_rewrite.c>
RewriteEngine on
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
RewriteBase /
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/2010/events/megaramp/(.*)$
RewriteRule ^(.*)$ /2010/events/megaramp/index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/asaevents/(.*)$
RewriteRule ^(.*)$ /asaevents/index.php?q=$1 [L,QSA]
</IfModule>
40.How to create a form using drupal custom module?
http://drupal.org/node/717750
41.List of drupal modules for slideshow and Tabs?
http://groups.drupal.org/node/20384
42.How can we theme a node?
http://www.caucusllc.com/blog/theming-a-cck-node
http://thanhsiang.org/faqing/node/96
http://hankpalan.com/blog/drupal-themes/theming-node-drupalthe-easy-way
for drupal 7: http://robotlikehuman.com/web/printing-cck-content-field-values-drupal-7
for body :<?php
print $node->content['body']['#value']
?>
for field : <?php print $node->field_attorneyimage[0]['view']; ?>
<?php print $node->field_firstname[0]['view']; ?>
43.How can we add the div style to the drupal form?
. Define a theme override function within your custom module as follows:
function theme_yourfunction_name($form) {
$form['country']['#attributes']['class'] = 'custom-form-radios';
$output = drupal_render($form);
return $output;44.what did you do when ever u upload to live site from localhost then empty blank page will come when ever u save or submit button?
http://drupal.org/node/158043
http://drupal.org/node/31819
http://amiworks.co.in/talk/the-white-screen-of-death/
http://devbee.com/dreaded_blank_page_of_death
http://forum.werockyourweb.com/drupal/drupal-blank-page-after-submit
45.How to diasable the errors from front end?
go to site config+'error reporting ', put option is 'write errors to the log.'
46.headers alredy sent error?
http://www.2by2host.com/articles/cannot-modify-header-information/
OR
goto 'your site/includes/common.inc'
delete this code
header($header);
$stored_headers[] = $header;
from
if (strlen($header)) {
header($header);
$stored_headers[] = $header;
}
return implode("\n", $stored_headers);
}
47.Image upload error in while uploading in live site?
http://drupal.org/node/810882
48.Time zone error in live site?
http://vsingleton.blogspot.in/
49.How to change the text of default value (-Any-) of an exposed filter in drupal views?
see this link
http://stackoverflow.com/questions/4668266/how-to-change-the-label-of-the-default-value-any-of-an-exposed-filter-in-dru
or write this code in .module file
<?php
function attorneyes_form_alter(&$form, $form_state, $form_id) {
if($form_state['view']->name == 'Advanced_Search') {
$form['tid_1']['#options']['All'] = t('Practice Area');
$form['tid']['#options']['All'] = t('Position');
$form['tid_2']['#options']['All'] = t('Office');
}
}
?>
49.How to change the text of default value (-Apply-) of an Submit button in drupal views?
see this link
http://stackoverflow.com/questions/4668266/how-to-change-the-label-of-the-default-value-any-of-an-exposed-filter-in-dru
or write this code in .module file
<?php
function attorneyes_form_alter(&$form, $form_state, $form_id) {
if($form_state['view']->name == 'Advanced_Search') {
$form['submit']['#value'] = t('Ravi');
}
}
?>
51.How to change the text with jquery?
$("#views-exposed-form-tree-info-articles-list-page-1 #edit-tid option:first").text("All");
52.How can we add the add the tabs to the node ?
use the following modules
1.CCK Fieldgroup Tabs
2. tabs
incase tabs are not visible after confiog , just diasble the 'Jquery-UI' module
53.how to theme the tabs in custom node tpl.php or corrct code to include the tabs in custom tpl.php?
<?php print theme_tabset($node->content['fieldgroup_tabs']); ?>
see the
http://drupal.org/node/17818354.How can we style the expopsed dropdowns in drupal?http://drupalsn.com/learn-drupal/drupal-tutorials/fancy-select-menus-drupal-using-jquery
55.How can we enable the block for one individual content type all pages?
content/news/* or news/* (Depends on url is generating for node page i.e in node page url contains 'content' means first one need to put, otherwise second one)
56.How to create the phpinfo.php file and which code need to write?
Just go to your root folder and create one php file with name called 'phpinfo.php' and place this code in to that file...
<?php
phpinfo();
?>
then go to your browser , click on http://mysite.com/phpinfo.php
thats it...
57.How can we print node id in node tpl file?
very simple answer is
<?php echo "".$node->nid .""; ?>
or
for this first <?php print_r($node) ?>
in above we need to know the in which field contains node id , copy that field name and paste in to below line field_name
<?php print $node->field_name[0]['nid'] ?>
58.How can we print the taxonomy terms in node page belongs to only one indiduval vocubulary?
http://drupal.org/node/133223
step 1. Put the following code in template.php
function print_terms($node, $vids = FALSE) {
$vocabularies = taxonomy_get_vocabularies();
foreach($vocabularies as $vocabulary){
if (in_array($vocabulary->vid, $vids) || empty($vids)) {
if($terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabulary->vid)){
unset($links);
foreach ($terms as $term){
$links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description)));
}
$output .= theme('item_list', $links, $title);
}
}
}
return $output;
}
step 2: put the following code in node tpl file
<?php print print_terms($tabsfive,$vids = array(2)); ?>
in above '2' is the vocubalary id
OR
http://drupal.org/node/133223
57.How can we print node id in node tpl file?
very simple answer is
<?php echo "".$node->nid .""; ?>
or
for this first <?php print_r($node) ?>
in above we need to know the in which field contains node id , copy that field name and paste in to below line field_name
<?php print $node->field_name[0]['nid'] ?>
58.How can we print the taxonomy terms in node page belongs to only one indiduval vocubulary?
http://drupal.org/node/133223
58.How to get taxonomy terms for the current node from a block?
<?phpif (arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) {
$terms = taxonomy_node_get_terms(arg(1));
}?>
or
<?phpif (arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) {
$terms = taxonomy_node_get_terms(arg(1));
$output .= "<ul>";
foreach($terms as $term){
//$taxo_id = 7;
$sql = "SELECT node.title, node.nid FROM node INNER JOIN term_node ON node.nid = term_node.nid WHERE term_node.tid = $term->tid LIMIT 5";
$result = db_query($sql);
while ($anode = db_fetch_object($result)) {
$output .= "<li>".l($anode->title, "node/$anode->nid")."</li>";
}
}
$output .= "</ul>";
return $output;
}?>
59. How can we print/get the taxonomy terms belongs to indiduval vocubalary?
step 1. Put the following code in template.php
function print_terms($node, $vids = FALSE) {
$vocabularies = taxonomy_get_vocabularies();
foreach($vocabularies as $vocabulary){
if (in_array($vocabulary->vid, $vids) || empty($vids)) {
if($terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabulary->vid)){
unset($links);
foreach ($terms as $term){
$links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description)));
}
$output .= theme('item_list', $links, $title);
}
}
}
return $output;
}
step 2: put the following code in node tpl file
<?php print print_terms($tabsfive,$vids = array(2)); ?>
in above '2' is the vocubalary id
OR
http://drupal.org/project/term_display
OR
http://drupal.org/node/133223
60. Remove Selection Border Around Image in Firefox?
add the following code in css file
input:focus {outline:none; border:none;}
input[type="submit"]:focus {outline:none;border:none;
-moz-outline-style: none;}
:focus { -moz-outline-style: none;border:none; }
button::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner {
border: none;
}
add the following code in css file
input:focus {outline:none; border:none;}
input[type="submit"]:focus {outline:none;border:none;
-moz-outline-style: none;}
:focus { -moz-outline-style: none;border:none; }
button::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner {
border: none;
}
61.How can u search differently in drupal with google?
http://www.missingubercartmanual.com/How-to-Search-for-Drupal-Themes-Modules-and-Information
62.How can we increase the max upload size for uploading the image/video/file while adding the content?
http://drupal.org/node/422474
63.Add CSS File To Specific Pages In Drupal?
if($_GET['q]=="node/2") {
drupal_add_css(path_to_theme() . '/crazy-style.css', 'theme', 'all');
}
62.How can we increase the max upload size for uploading the image/video/file while adding the content?
http://drupal.org/node/422474
63.Add CSS File To Specific Pages In Drupal?
if($_GET['q]=="node/2") {
drupal_add_css(path_to_theme() . '/crazy-style.css', 'theme', 'all');
}
or
http://www.fakingfantastic.com/2009/12/10/add-css-file-to-specific-pages-in-drupal/
64. About CCK Vcard or How can we give 'Download vcard' in VCF formate?
1. download cck vcard module,
2. add the fields to paricular content type which fields you are using for Vcard'(Normal fields)
3. we need to add the vcard field paricular content type i.e in manage filds 'select field type ' is 'vacrd'
4. go to particular content type and edit that and go to CCK V card settings, then click on 'Enable' then select which fields you are using for Vcard'
5. add the content as usaval and in in node page it comes as common but it does not come in view page, so we need to add the custom link using global , in link filed we need to put 'http://localhostconnellfoley/cck_vcard/vcard.php?[nid]''
65.How can we get the node id from url?
<?php print $nid = arg(1);
?>
66.How can we get the cck field image from database with custom query?
<?php
// Make a MySQL Connection
// Construct our join query
// $nid = arg(1);
$query = "SELECT content_type_page.field_atonomyimage_fid, content_type_page.nid, files.fid , files.filepath ".
"FROM content_type_page, files ".
"WHERE content_type_page.field_atonomyimage_fid = files.fid";
$result = db_query($query) or die(mysql_error());
// Print out the contents of each row into a table
while($row = db_fetch_array($result)){
$path= $row['filepath'];
echo "<br />";
print '<img src="'. $path.'" height="100" width:"100"/>';
}
?>
67.How can we print the block in node?
1.in .info file
regions[node_message] = Node Message
(the above region should not print in page.tpl.php)
2.in template.php file
function my_theme_name_preprocess_node(&$vars, $hook) {
$vars['node_message'] = theme('blocks', 'node_message');
}
3.In node.tpl.php file
<?php if ($node_message): ?>
<div class="node-message"><?php print $node_message; ?></div>
<?php endif; ?>
thats it..
for ref :
http://highrockmedia.com/blog/how-to-add-block-region-to-node-page-drupal-6
68.How can we changed the views query or alter the view?
By using hook_views_query_alter
ex:
function viewsort_views_query_alter(&$view, &$query) {
if ( $view->name == 'news_view' ) {
$sort = $_REQUEST['sort-order'];
switch ($sort) {
case "all":
$view->set_items_per_page(10000);
$view->set_use_pager(FALSE);
break;
case "top10":
$view->set_items_per_page(2);
$view->set_use_pager(FALSE);
break;
case "asc":
// modify the sorting criteria according to your view query shown in Views UI
$query->orderby[0]='node.changed ASC';
break;
case "des":
// modify the sorting criteria according to your view query shown in Views UI
$query->orderby[0]='node.changed DESC';
break;
}
}
Note: query info is in $query array varible, remaing some view config options in $view array varible
http://snipplr.com/view/26066/
http://www.appnovation.com/using-hook-views-query-alter
http://ionutstan.ro/limit-records-displayed-view-using-hookviewsqueryalter-drupal-6-website
69.open in new in window for drupal menu?
Menu attributes module for both internal and external links
External links module will do the same thing ,but only for external links
70. How can we theme a field for our theme?
http://drupal.org/node/269319#comment-4131810
you'll also need to copy content-field.tpl.php into your theme directory from CCK module 's sites/all/modules/cck/theme . I couldn't get content-field-field_image.tpl.php to work in my theme until I copied content-field.tpl.php in as well.
71.How can we theme/style a view?
take row style tpl file from view and create in our view and add that tpl file to our view , in that theme view tpl file write the following lines of code
<?php
foreach ($fields as $fieldname => $fielddata) {
print $fieldname . '<br />';
}
then we can able to see the all values , like below
title
field_text_content
field_mycckfield_content
then by using above one update the below l code fileds and add that in to our HTML's
<?php print '<h2 class="articletitle">' . $fields['title']->content . '</h2>';
or
print $fields['field_text_value']->content;
or
print $fields['field_mycckfield_value']->content;
thats it....
for more details: http://www.hashbangcode.com/blog/drupal-6-views-templates-544.html
72.How can u get the node id in page.tpl.php?
anser is arg(1)
<?php if (arg(1) != '715'): ?>
<h1 class="title"><?php print $title; ?></h1>
<?php endif; ?>
73.How can we get/print the above url or path into our module?
<?php
function viewsort_views_query_alter(&$view, &$query) {
if ( $view->name == 'attornyes' ) {
$current_url = 'http://' .$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI'];
$myArgs = arg(2);
drupal_set_message($current_url );
drupal_set_message($myArgs );
}}
?>
74.Content Encoding Error
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.what did u do while u get this error?
simple, when evr u are imort the database u need to clear cache, then only we need to take the back up of db or delete the cache insert tables
75.How can u create the page tpl file in .module file while u creating custom module?
function whitepaper_preprocess_page(&$variables){
if (arg(0)=="download_whitepaper_now") {
$variables['theme_hook_suggestions'][] = 'page__fullcontent';
}
}
75.How can u include the HTML or text or PHP varibles in drupal .module file?
<?php
Echo "<html>";
Echo "<title>HTML with PHP</title>";
Echo "<b>My Example</b>";
//your php code here
Print "<i>Print works too!</i>";
?>
<?php
$output .= '<h2>Download Whitepaper Now!</h2>
<div id="whitepaper" class="reg-form">
<form id="Form1" action="" method="post" name="Form1">
<div class="row">
<label>First Name : <span class="mandatory">*</span></label>
<div class="data"><input type="text" id="first_name" size="30" name="first_name" class="text-field"></div>
<div class="clear-form"></div>
</div>
<div class="row">
<label>Last Name : <span class="mandatory">*</span></label>
<div class="data"><input type="text" id="last_name" size="30" name="last_name" class="text-field"></div>
<div class="clear-form"></div>
</div>
<div class="row">
<label>Company : <span class="mandatory">*</span></label>
<div class="data"><input type="text" id="company" size="30" name="company" class="text-field"></div>
<div class="clear-form"></div>
</div>
<div class="row">
<label>Email : <span class="mandatory">*</span><br /><span class="hint">(we will keep your email completely private)</span></label>
<div class="data"><input type="text" id="email" size="30" name="email" class="text-field"></div>
<div class="clear-form"></div>
</div>
<div class="row">
<label>Which one of these industries best describes your company? : <span class="mandatory">*</span></label>
<div class="data">
<select id="industry_type" name="industry_type" class="selct-op">
<option value="">Select...</option>
<option value="Aircraft">Aircraft</option>
<option value="Automotive">Automotive</option>
<option value="Business Services">Business Services</option>
<option value="Entertainment">Entertainment</option>
<option value="Hi-tech">Hi-tech</option>
<option value="Medical">Medical</option>
<option value="Retail Goods">Retail Goods</option>
<option value="Other">Other</option>
</select>
</div>
<div class="clear-form"></div>
</div>
<div class="row">
<input type="submit" id="btnSubmit" value="Download now" name="btnSubmit" class="submit btn">
</div>
</form>
</div>
</div>';
return $output;
?>
<?php
$output .= '<br />
Thank you!<br /><br />Bill Hale<br />Vice President, Sales and Marketing<br />Network Global Logistics';
$output .= 'Thank you for requesting the "'.$pdf_whitepaper_title.'" whitepaper. You can download it <a href="'.$site_path.'/?q=force_download">here</a><br />';
return "<div class='titleclass'>".l($result2[0]->node_title, "download_whitepaper_now/$targetid")."</div>";
?>
<?php
function fetch_athlete_list_content($global_vars, $pageno){
$con = mysql_connect($global_vars['host'],$global_vars['db_user'],$global_vars['db_password']);
$content = "<div><div id='athletesListing'><div class='titleHolder'><h3>Athletes</h3></div>";
$athletes_collection = array();
$athletes_count = 0;
if (!$con){
die('Could not connect: ' . mysql_error());
}else{
mysql_select_db($global_vars['db_name'], $con);
//fetch results from DB
$query = "SELECT count(*) FROM vw_subsite_athletes WHERE subsite='".$global_vars['site_id']."'";
$result = mysql_query($query, $con) or trigger_error("SQL", E_USER_ERROR);
$query_data = mysql_fetch_row($result);
$numrows = $query_data[0];
$content = $content."<div>";
$rows_per_page = 16;
$lastpage = ceil($numrows/$rows_per_page);
$pageno = (int)$pageno;
if ($pageno > $lastpage) {
$pageno = $lastpage;
} // if
if ($pageno < 1) {
$pageno = 1;
} // if
$limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
$query = "SELECT * FROM vw_subsite_athletes WHERE subsite='".$global_vars['site_id']."'"." $limit";
// $query = "SELECT * FROM vw_subsite_athletes $limit";
$result = mysql_query($query, $con) or trigger_error("SQL", E_USER_ERROR);
if(!empty($result)){
while($rows = mysql_fetch_array($result)){
$content = $content."<div class='playerDetailsContainer'>";
$content = $content."<div class='playerWrap'>";
$content = $content."<div class='playerName'><h2>".$rows['name']."</h2></div>";
$content = $content."<div class='playerImage'>";
$img_src = curHostURL()."/".$rows['image'];
$content = $content."<img height='112' width='113' alt='player image' src='".$img_src."'>";
$content = $content."</div>";
$content = $content."<div class='playerDetails'>";
$content = $content."<div class='JumpToPlayerFullDetails'>";
$bio_href = curHostURL()."/content/".str_replace(" ","-",strtolower($rows['name'])); ;
$content = $content."<ul><li><a class='bio' href='".$bio_href."'> </a></li>";
$content = $content."</ul></div>";
$content = $content."<ul class='playerBio'>";
$content = $content."<li><label>Home Town:</label><span>".$rows['hometown']."</span></li>";
$content = $content."<li><label>Age:</label><span>".$rows['age']."</span></li>";
$content = $content."<li><label>Height:</label><span>".$rows['height']."</span></li>";
$content = $content."<li><label>Weight:</label><span>".$rows['weight']."</span></li>";
$content = $content."</ul></div>";
$content = $content."</div>";
$content = $content."<div class='bottomWrap'></div>";
$content = $content."</div>";
$athletes_count ++;
}//end of while
}//end of if results
$content = $content."<div id='athlete-pager'>";
if ($pageno == 1) {
$content = $content."<a href='#'> first </a><a href='#'> prev </a>";
//echo " FIRST PREV ";
} else {
//add_or_change_parameter("page", "2");
//$content = $content." <a href='".formatURL()."&pageno=1'>FIRST</a> ";
$content = $content." <a href='".add_or_change_parameter('pageno','1')."'>first</a> ";
$prevpage = $pageno-1;
//$content = $content." <a href='".formatURL()."&pageno=$prevpage'>PREV</a> ";
$content = $content." <a href='".add_or_change_parameter('pageno',$prevpage)."'>prev</a> ";
} // if
$content = $content."<span> ( page $pageno of $lastpage ) </span>";
//echo " ( page $pageno of $lastpage ) ";
if ($pageno == $lastpage) {
$content = $content."<a href='#'> next </a><a href='#'> last </a> ";
//echo " NEXT LAST ";
} else {
$nextpage = $pageno+1;
//$content = $content." <a href='".formatURL()."&pageno=$nextpage'>Next</a> ";
$content = $content." <a href='".add_or_change_parameter('pageno',$nextpage)."'>next</a> ";
//$content = $content." <a href='".formatURL()."&pageno=$lastpage'>Last</a> ";
$content = $content." <a href='".add_or_change_parameter('pageno',$lastpage)."'>last</a> ";
} // if
$content = $content."</div>";
}//end of if results
$content = $content."</div>";
//Close the Connection
mysql_close($con);
return $content;
}
?>
76.Different Registration forms in drupal 7 bu using Profile 2 module ?
Publish Page
64. About CCK Vcard or How can we give 'Download vcard' in VCF formate?
1. download cck vcard module,
2. add the fields to paricular content type which fields you are using for Vcard'(Normal fields)
3. we need to add the vcard field paricular content type i.e in manage filds 'select field type ' is 'vacrd'
4. go to particular content type and edit that and go to CCK V card settings, then click on 'Enable' then select which fields you are using for Vcard'
5. add the content as usaval and in in node page it comes as common but it does not come in view page, so we need to add the custom link using global , in link filed we need to put 'http://localhostconnellfoley/cck_vcard/vcard.php?[nid]''
65.How can we get the node id from url?
<?php print $nid = arg(1);
?>
66.How can we get the cck field image from database with custom query?
<?php
// Make a MySQL Connection
// Construct our join query
// $nid = arg(1);
$query = "SELECT content_type_page.field_atonomyimage_fid, content_type_page.nid, files.fid , files.filepath ".
"FROM content_type_page, files ".
"WHERE content_type_page.field_atonomyimage_fid = files.fid";
$result = db_query($query) or die(mysql_error());
// Print out the contents of each row into a table
while($row = db_fetch_array($result)){
$path= $row['filepath'];
echo "<br />";
print '<img src="'. $path.'" height="100" width:"100"/>';
}
?>
67.How can we print the block in node?
1.in .info file
regions[node_message] = Node Message
(the above region should not print in page.tpl.php)
2.in template.php file
function my_theme_name_preprocess_node(&$vars, $hook) {
$vars['node_message'] = theme('blocks', 'node_message');
}
3.In node.tpl.php file
<?php if ($node_message): ?>
<div class="node-message"><?php print $node_message; ?></div>
<?php endif; ?>
thats it..
for ref :
http://highrockmedia.com/blog/how-to-add-block-region-to-node-page-drupal-6
68.How can we changed the views query or alter the view?
By using hook_views_query_alter
ex:
function viewsort_views_query_alter(&$view, &$query) {
if ( $view->name == 'news_view' ) {
$sort = $_REQUEST['sort-order'];
switch ($sort) {
case "all":
$view->set_items_per_page(10000);
$view->set_use_pager(FALSE);
break;
case "top10":
$view->set_items_per_page(2);
$view->set_use_pager(FALSE);
break;
case "asc":
// modify the sorting criteria according to your view query shown in Views UI
$query->orderby[0]='node.changed ASC';
break;
case "des":
// modify the sorting criteria according to your view query shown in Views UI
$query->orderby[0]='node.changed DESC';
break;
}
}
Note: query info is in $query array varible, remaing some view config options in $view array varible
http://snipplr.com/view/26066/
http://www.appnovation.com/using-hook-views-query-alter
http://ionutstan.ro/limit-records-displayed-view-using-hookviewsqueryalter-drupal-6-website
69.open in new in window for drupal menu?
Menu attributes module for both internal and external links
External links module will do the same thing ,but only for external links
70. How can we theme a field for our theme?
http://drupal.org/node/269319#comment-4131810
you'll also need to copy content-field.tpl.php into your theme directory from CCK module 's sites/all/modules/cck/theme . I couldn't get content-field-field_image.tpl.php to work in my theme until I copied content-field.tpl.php in as well.
71.How can we theme/style a view?
take row style tpl file from view and create in our view and add that tpl file to our view , in that theme view tpl file write the following lines of code
<?php
foreach ($fields as $fieldname => $fielddata) {
print $fieldname . '<br />';
}
then we can able to see the all values , like below
title
field_text_content
field_mycckfield_content
then by using above one update the below l code fileds and add that in to our HTML's
<?php print '<h2 class="articletitle">' . $fields['title']->content . '</h2>';
or
print $fields['field_text_value']->content;
or
print $fields['field_mycckfield_value']->content;
thats it....
for more details: http://www.hashbangcode.com/blog/drupal-6-views-templates-544.html
72.How can u get the node id in page.tpl.php?
anser is arg(1)
<?php if (arg(1) != '715'): ?>
<h1 class="title"><?php print $title; ?></h1>
<?php endif; ?>
73.How can we get/print the above url or path into our module?
<?php
function viewsort_views_query_alter(&$view, &$query) {
if ( $view->name == 'attornyes' ) {
$current_url = 'http://' .$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI'];
$myArgs = arg(2);
drupal_set_message($current_url );
drupal_set_message($myArgs );
}}
?>
74.Content Encoding Error
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.what did u do while u get this error?
simple, when evr u are imort the database u need to clear cache, then only we need to take the back up of db or delete the cache insert tables
75.How can u create the page tpl file in .module file while u creating custom module?
function whitepaper_preprocess_page(&$variables){
if (arg(0)=="download_whitepaper_now") {
$variables['theme_hook_suggestions'][] = 'page__fullcontent';
}
}
75.How can u include the HTML or text or PHP varibles in drupal .module file?
<?php
Echo "<html>";
Echo "<title>HTML with PHP</title>";
Echo "<b>My Example</b>";
//your php code here
Print "<i>Print works too!</i>";
?>
<?php
$output .= '<h2>Download Whitepaper Now!</h2>
<div id="whitepaper" class="reg-form">
<form id="Form1" action="" method="post" name="Form1">
<div class="row">
<label>First Name : <span class="mandatory">*</span></label>
<div class="data"><input type="text" id="first_name" size="30" name="first_name" class="text-field"></div>
<div class="clear-form"></div>
</div>
<div class="row">
<label>Last Name : <span class="mandatory">*</span></label>
<div class="data"><input type="text" id="last_name" size="30" name="last_name" class="text-field"></div>
<div class="clear-form"></div>
</div>
<div class="row">
<label>Company : <span class="mandatory">*</span></label>
<div class="data"><input type="text" id="company" size="30" name="company" class="text-field"></div>
<div class="clear-form"></div>
</div>
<div class="row">
<label>Email : <span class="mandatory">*</span><br /><span class="hint">(we will keep your email completely private)</span></label>
<div class="data"><input type="text" id="email" size="30" name="email" class="text-field"></div>
<div class="clear-form"></div>
</div>
<div class="row">
<label>Which one of these industries best describes your company? : <span class="mandatory">*</span></label>
<div class="data">
<select id="industry_type" name="industry_type" class="selct-op">
<option value="">Select...</option>
<option value="Aircraft">Aircraft</option>
<option value="Automotive">Automotive</option>
<option value="Business Services">Business Services</option>
<option value="Entertainment">Entertainment</option>
<option value="Hi-tech">Hi-tech</option>
<option value="Medical">Medical</option>
<option value="Retail Goods">Retail Goods</option>
<option value="Other">Other</option>
</select>
</div>
<div class="clear-form"></div>
</div>
<div class="row">
<input type="submit" id="btnSubmit" value="Download now" name="btnSubmit" class="submit btn">
</div>
</form>
</div>
</div>';
return $output;
?>
<?php
$output .= '<br />
Thank you!<br /><br />Bill Hale<br />Vice President, Sales and Marketing<br />Network Global Logistics';
$output .= 'Thank you for requesting the "'.$pdf_whitepaper_title.'" whitepaper. You can download it <a href="'.$site_path.'/?q=force_download">here</a><br />';
return "<div class='titleclass'>".l($result2[0]->node_title, "download_whitepaper_now/$targetid")."</div>";
?>
<?php
function fetch_athlete_list_content($global_vars, $pageno){
$con = mysql_connect($global_vars['host'],$global_vars['db_user'],$global_vars['db_password']);
$content = "<div><div id='athletesListing'><div class='titleHolder'><h3>Athletes</h3></div>";
$athletes_collection = array();
$athletes_count = 0;
if (!$con){
die('Could not connect: ' . mysql_error());
}else{
mysql_select_db($global_vars['db_name'], $con);
//fetch results from DB
$query = "SELECT count(*) FROM vw_subsite_athletes WHERE subsite='".$global_vars['site_id']."'";
$result = mysql_query($query, $con) or trigger_error("SQL", E_USER_ERROR);
$query_data = mysql_fetch_row($result);
$numrows = $query_data[0];
$content = $content."<div>";
$rows_per_page = 16;
$lastpage = ceil($numrows/$rows_per_page);
$pageno = (int)$pageno;
if ($pageno > $lastpage) {
$pageno = $lastpage;
} // if
if ($pageno < 1) {
$pageno = 1;
} // if
$limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
$query = "SELECT * FROM vw_subsite_athletes WHERE subsite='".$global_vars['site_id']."'"." $limit";
// $query = "SELECT * FROM vw_subsite_athletes $limit";
$result = mysql_query($query, $con) or trigger_error("SQL", E_USER_ERROR);
if(!empty($result)){
while($rows = mysql_fetch_array($result)){
$content = $content."<div class='playerDetailsContainer'>";
$content = $content."<div class='playerWrap'>";
$content = $content."<div class='playerName'><h2>".$rows['name']."</h2></div>";
$content = $content."<div class='playerImage'>";
$img_src = curHostURL()."/".$rows['image'];
$content = $content."<img height='112' width='113' alt='player image' src='".$img_src."'>";
$content = $content."</div>";
$content = $content."<div class='playerDetails'>";
$content = $content."<div class='JumpToPlayerFullDetails'>";
$bio_href = curHostURL()."/content/".str_replace(" ","-",strtolower($rows['name'])); ;
$content = $content."<ul><li><a class='bio' href='".$bio_href."'> </a></li>";
$content = $content."</ul></div>";
$content = $content."<ul class='playerBio'>";
$content = $content."<li><label>Home Town:</label><span>".$rows['hometown']."</span></li>";
$content = $content."<li><label>Age:</label><span>".$rows['age']."</span></li>";
$content = $content."<li><label>Height:</label><span>".$rows['height']."</span></li>";
$content = $content."<li><label>Weight:</label><span>".$rows['weight']."</span></li>";
$content = $content."</ul></div>";
$content = $content."</div>";
$content = $content."<div class='bottomWrap'></div>";
$content = $content."</div>";
$athletes_count ++;
}//end of while
}//end of if results
$content = $content."<div id='athlete-pager'>";
if ($pageno == 1) {
$content = $content."<a href='#'> first </a><a href='#'> prev </a>";
//echo " FIRST PREV ";
} else {
//add_or_change_parameter("page", "2");
//$content = $content." <a href='".formatURL()."&pageno=1'>FIRST</a> ";
$content = $content." <a href='".add_or_change_parameter('pageno','1')."'>first</a> ";
$prevpage = $pageno-1;
//$content = $content." <a href='".formatURL()."&pageno=$prevpage'>PREV</a> ";
$content = $content." <a href='".add_or_change_parameter('pageno',$prevpage)."'>prev</a> ";
} // if
$content = $content."<span> ( page $pageno of $lastpage ) </span>";
//echo " ( page $pageno of $lastpage ) ";
if ($pageno == $lastpage) {
$content = $content."<a href='#'> next </a><a href='#'> last </a> ";
//echo " NEXT LAST ";
} else {
$nextpage = $pageno+1;
//$content = $content." <a href='".formatURL()."&pageno=$nextpage'>Next</a> ";
$content = $content." <a href='".add_or_change_parameter('pageno',$nextpage)."'>next</a> ";
//$content = $content." <a href='".formatURL()."&pageno=$lastpage'>Last</a> ";
$content = $content." <a href='".add_or_change_parameter('pageno',$lastpage)."'>last</a> ";
} // if
$content = $content."</div>";
}//end of if results
$content = $content."</div>";
//Close the Connection
mysql_close($con);
return $content;
}
?>
Install profile 2
module and enable profile 2 module required module also enable (Entity).
And install Profile2 Registration Path module and enable.
Profile2 enable
Profile2 pages enable
Profile2 Registration Path enable
First create Roles
Home » Administration » People » Permissions
Add
role ->tipsters role type
The human-readable name of this profile
type.
Show
on all user account registration forms.
If selected, fields for this profile type
will be added to the core user registration page and the administrative add
user page.
Provide
a separate page for editing profiles.
If enabled, a separate menu item for
editing the profile is generated and the profile is hidden from the user
account page.
Unique
registration path
Enable
unique registration path
If checked, a unique registration page
utilizing this profile type's fields will be available at the specified URL.
Settings
URL path http://localhost/drupaltest/
/register
Please enter the base URL for this registration
path.
- Menu router items for [path], [path]/register, [path]/login, and [path]/password will be generated.
- You may use the "user" base path to attach this profile to the default user registration form.
- Do not include any slashes.
Set
custom page titles for the login, register, and forgot password pages.
Enabling this option will permit you to
override the default title of "User Account" on the login, register,
and forgot password pages.
Display
a confirmation message after registration.
Enabling this option display a custom
confirmation message to the user after a successful registration.
Confirmation Message
Enter the confirmation message that you
would like to display.
Wrap
profile fields in a fieldset
If checked, all profile fields for this
profile type will be wrapped in a fieldset titled on the user registration
form.
Assign roles during registration
administrator
tipsters
subscriber
Please select any roles that you would like
to automatically assign to users registering via this registration path.
Weight
If multiple sets of profile fields are
attached to a single registration path, they will be sorted in ascending order
by weight. This will affect both the order of profile fields and the title
settings.
add Manage fields-à
next logout
Localhost/drupaltest/tipster/register
Publish Page