Full Trust European Hosting

BLOG about Full Trust Hosting and Its Technology - Dedicated to European Windows Hosting Customer

Drupal 7 with Free ASP.NET Hosting - HostForLIFE.eu :: How to Create Your Own Drupal 7 Theme

clock June 1, 2015 07:09 by author Rebecca

Like other CMS platforms, Drupal allows us to create custom themes and templates. In this tutorial, you’re going to learn how to create a new theme and defining or configuring a theme in Drupal 7.

Theme Structure

To define a new theme in Drupal 7, you need to create folders and files according to Drupal’s rule.

So, we start by create the following folders:

Go to root folder of Drupal > Sites > All > Theme and create theme folders as below:

  • mytheme is the folder that contains themes and can be renamed to your theme’s name.
  • mytheme.info is file used to define theme name, version, core ,css, javascript.
  • screenshot.png is thumbnail of theme, which is showed in theme management section.

Defining theme using .info file

The .info file is a static text file for defining and configuring a theme. Each line in the .info file is a key-value pair with the key on the left and the value on the right, with an “equals sign” between them (eg:   name = my_theme ).

Now, open mytheme.info and start defining:

Theme name (required):

name = mytheme

Description:

description = tutorialdrupal.com how to create and define drupal theme

Theme version

version = 0.1

Core drupal

core = 7.x

Engine

engine = phptemplate

Screenshot

screenshot = screenshot.png

After finishing, we will have a new .info  file like this:
name = mytheme
description = tutorialdrupal.com how to create and define drupal theme
version = 0.1
core = 7.x
engine = phptemplate
screenshot = screenshot.png

Now save the file, go to theme management section, you will see the new theme you’ve just created:

Defining Drupal website’s regions

Region is section for showing Drupal website’s blocks. Regions are defined as follows:

regions[header] = Header
regions[highlighted] = Highlighted
regions[help] = Help
regions[content] = Content
regions[sidebar_first] = Left sidebar
regions[sidebar_second] = Right sidebar
regions[footer] = Footer

After you’re done, save the file and click on “enable and set default” to set this theme as default theme. Now go to Structure -> Block, you will see the new defined regions:

1. Include css file

stylesheets[all][] = style.css
stylesheets[print][] = print.css

2. Include javascript file

scripts[] = myscript.js

So, you’ve just created a new theme in Drupal 7. It's not a difficult task, right?

Drupal CMS with Free ASP.NET Hosting
Try our Drupal CMS with Free ASP.NET Hosting today and your account will be setup soon! You can also take advantage of our Windows & ASP.NET Hosting support with Unlimited Domain, Unlimited Bandwidth, Unlimited Disk Space, etc. You will not be charged a cent for trying our service for the next 3 days. Once your trial period is complete, you decide whether you'd like to continue.



Drupal CMS with Free ASP.NET Hosting - HostForLIFE.eu :: Fixing Drupal Fatal Error "Allowed memory size of A bytes exhausted (tried to allocate B bytes)"

clock April 24, 2015 07:30 by author Rebecca

Sometimes when working with Drupal, you suddenly see this error: 
Allowed memory size of A bytes exhausted (tried to allocate B bytes)
or

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3669969 bytes) in ../public_html/includes/theme.inc on line 1987

How to handle this error? That error message tells you that Drupal needed more memory than PHP was allowed to give it. In this article, I will explain to you 3 methods to increase PHP memory size, pick one that you like:

1. Fix the error in Drupal 6/7 using php.ini file

You will probably see this error message when you install new modules/themes. By default, Drupal 6/7 allocates 64M (megabytes) of memory on your website and so, to fix this issue you need to increase memory limit to higher value (128MB is fine).

Here is the solution:

1. Connect to your Drupal web hosting using SSH/FTP connection

2. Check if there’s php.ini  file in root folder of your hosting

3. If it’s existing, open the file with text editor (notepad) and add the value  php_value memory_limit = "128M"

4. If there’s no  php.ini file in root folder, then you need to create one. Use notepate, wordpad or whatever can edit and save text file as .ini  file add the value  php_value memory_limit = "128M"

5. Save the file if check the error’s gone

(Note: remember to save file with name: php.ini, not php.ini.txt)

2. Increase PHP memory using .httaccess

Edit the .htaccess file in the Drupal root directory. Look for the section:

Override PHP settings. More in sites/default/settings.php

But the following cannot be changed at runtime

Now add the following line:
php_value memory_limit 64M
This method will only work if PHP is running as an Apache module.

3. Using settings.php

If Drupal is already installed, you can edit sites/default/settings.php. This method will affect only the site using this file.
Locate the PHP settings section and add the following line at the end of that section:
ini_set('memory_limit', '64M');

That’s all for today, hope you will solve this issue immediately after reading this!

Drupal CMS with Free ASP.NET Hosting
Try our Drupal CMS with Free ASP.NET Hosting today and your account will be setup soon! You can also take advantage of our Windows & ASP.NET Hosting support with Unlimited Domain, Unlimited Bandwidth, Unlimited Disk Space, etc. You will not be charged a cent for trying our service for the next 3 days. Once your trial period is complete, you decide whether you'd like to continue.



About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in