Warning: require_once(./includes/database.inc) [function.require-once]: failed to open stream: No such file or directory in /public_html/includes/bootstrap.inc on line 1021
Ajay on December 14th, 2009All of sudden I got following error in one of my Drupal website
Warning: require_once(./includes/database.inc) [function.require-once]: failed to open stream: No such file or directory in /public_html/includes/bootstrap.inc on line 1021
Fatal error: require_once() [function.require]: Failed opening required ‘./includes/database.inc’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /public_html/includes/bootstrap.inc on line 1021
Digging down further I discovered that the files are somehow corrupted as I had moved the files from one host to another. I uploaded files again and it solved the problem.
Also a loto of folders were not uploaded correctly.
Drupal – How to enable navigation menu in Admin
Ajay on July 16th, 2008There might be case when you have disabled the navigation menu in the front of Drupal and would like to enable it in just Admin.
To do so go to admin->build->block
Enable the Navigation menu and attach it to left, right, header or footer wherever you want.
Then click on Configure against this and make it visible for authenticated user so that it shall be visible to Admin only.
How to specify front page in Drupal?
Ajay on June 28th, 2008In Drupal it is little tricky to specify which page would be home page.
You can specify which page you would like to be shown as home page from Admin->Settings->Site Information
admin/settings/site-information
In the Default front page: enter the node which you would like to make to be displayed on front page.
this value should be node/1 or any node which you wish to make home page.
Drupal and WAI Accessibility
Ajay on February 10th, 2008One question people frequently ask is whether Drupal is WAI compatible?
Well the question itself is not quite correct. Drupal is just a framework and no one writes any code to always keep it WAI compatible.
You have to “Do Extra Work” to make any website, whether based on Drupal or any open source framework or developed from scratch, to be WAI compatible.
So the question would have been “Can we make Drupal website using AJAX and Javascript to be WAI L2 compatible?”
Answer is YES.
Complex part is getting it done, which involves a lot of extra work.
Drupal’s page serving mechanism
Ajay on January 31st, 2008An excellent topic to understand the flow of Drupal’s page serving mechanism
Call to undefined function db_query()
Ajay onDrupal provides the function db_query() to interact with database.
This function is defined in includes/database.inc file.
You have to include database.inc in your file to get db_query() working.
<?php include(“includes/database.inc”); ?>
However if you are trying to access drupal database from a non-drupal .php file then all you need to do is to include following lines at the top of your file.
require_once ‘./includes/bootstrap.inc’;
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
Drupal Theming – How to print the attached image?
Ajay on January 29th, 2008If you are modifying Drupal theme and wish to play with attached image then following code might be helpful.
This code prints attached image (to a node) .
<?php
foreach ($node->files as $file)
{
$fileType = $file->filemime;
if($fileType == ‘image/jpeg’)
{
$imagePath = $file->filepath;
$imageTitle = $file->description;
print ‘<img class=”contentImage” width=”100″ height=”80″ src=”/’.$imagePath.’” alt=”‘.$imageTitle.’” title=”" />’;
}
}
?>
You can modify it as per your requirements. The above code prints all the attached images.
Drupal pathauto tutorial
Ajay on January 14th, 2008pathauto module could be extremely frustrating for any newcomer to Drupal.
pathauto module generates URL automatically based on the pattern which you specify in the configuration.
pathauto home page: http://drupal.org/handbook/modules/pathauto
First delete the alias settings for the types for which you wish to change pathauto settings.
E.g. if you want to change the Category URLs then delete all existing aliases first before making changes or else the new changes will not be reflected.
pathauto configuration for Category
Set the default path setting to be [vocab-raw]/[cat-raw] and you will get a very nice hierarchical URL.
See it live on www.SwamiPC.co.uk – http://www.swamipc.co.uk/desktop-pc/acer
URL Path Settings
While adding any page/product etc you can specify the name of URL and it will be automatically generated.
Uncheck the Automatic alias box and add the name which you want to be displayed in URL for that item.
E.g. for About us page I specified about in URL path settings which gives me URL http://www.swamipc.co.uk/about
Reasons why I don’t like Drupal
Ajay on January 13th, 2008Reason No. 1
It is not developed by native English speaking people. This is biggest drawback of Drupal which is reflected in almost all aspect of Drupal for which I don’t like it.
Few years back when I first started exploring Drupal I gave up as I could not understand the way it was written.
On the contrary it just took me 10 minutes to setup my first Joomla based web site.
Reason No. 2
It is too complex. I’ve worked with almost all of open source packages and it is undoubtedly the most complex CMS package to work with
Reason No. 3
The contents are not organized as it should have been. They got nodes then they added taxonomy and topped up with terms, vocabulary etc and all these hotch potch takes all your time to figure out what to put where.
Reason No. 4 – Ecommerce
They are trying desperately to integrate ecommerce package into CMS. I appreciate the effort and see it is almost coming good, however the basic framework of Drupal itself is not organized and adding ecommerce further makes it complex to glues everything together.
Reason No. 5 – SEO
Begin SEO guru I always look for an easy way to enable SEO freidnly URLS, keyword etc but Drupal gives me sleepless night in getting it together.
Reason No. 6
It is slow. It takes time to load after mouse click, it really takes a lot of time.
How to disable displaying Author name and date
Ajay onYou can disable Author name and date appearing on contents from
Adminster->Site Building->Themes->Configure->Global Settings
See the Display post information on box
Enable or disable the submitted by Username on date text when displaying posts of the following type.
You can uncheck the type where you don’t want it to be displayed.