Using image presets programmatically (programmatically use imagecache)
! Legacy Drupal 7 code !
Compared to Drupal 6 where we used the imagecache API module, in Drupal 7 it has changed. In Drupal 6 we could use a preset programmatically as follows:
<?php print theme('imagecache', ‘my_preset’, $file_path, $alt, $title, $attributes); ?>
For example, like this:
theme('imagecache', '300x300crop', $first_photo["filepath"], $node->title, $node->title, array('itemprop' => 'image'));
But in Drupal 7, we write it a bit differently:
Show block on pages of a certain type of content
!Legacy Drupal 7 code below!
Sometimes you need to display a block only on specific pages of a certain content type. In the standard block visibility settings, you can only configure visibility by path or user role. The following code, entered into the block visibility settings with PHP mode enabled, allows you to choose the content types on which the block will be shown.
HTML First Steps - Lesson 1 - Tags h1-h6, p, strong
Read about how to create HTML documents in HTML – First Steps.
In the previous lesson, we created our first HTML document.
HTML First Steps - Lesson 2 - p, div tags and their differences. br tag
In the previous lesson, we created our first HTML document, which means you now know how to write HTML code in a text editor and view changes in the browser by refreshing the page (usually by pressing F5).
In this lesson, we’ll continue working with text and use tags like span
, p
, and div
. We’ll also look at the br
tag.
HTML first steps - lesson 3 - list tags ul, ol. Attributes of HTML tags.
Lists are frequently used on websites — in menus, within text, or for any kind of enumeration. Let’s start with the most common type: the unordered list using the <ul></ul>
tags.
UL List
The <ul>
tag is used for unordered (bulleted) lists. Through HTML, we can also define the type of bullet marker.
Let’s update our HTML code:
HTML First Steps - Lesson 4 - Links (Hyperlinks)
We’ve reached the very foundation of HTML — what it was created for — namely, hyperlinks (or simply links). Links are a way of organizing connections between different materials. Suppose you have 100,000 text files and want to create a catalog for them. Even if each catalog contains descriptions of 200 text files, you'd need 500 catalogs. Browsing through all 500 to find the right file would take a lot of time. So how do links help?
HTML First Steps - Lesson 5 - Tables
One of the important ways to store information is with tables. Tables are used in Excel, Access, and other databases. Tables are a clear way to present data, and they make it easy to create charts and diagrams. In this lesson, we’ll look at how to create tables in HTML using the tags <table>, <tr>, <td>, <th>, <thead>, <tbody>, and <tfoot>.
HTML First Steps - Lesson 6 - Images
Images are a very important element of a website—without them, it looks dull and unattractive. Images are used for visual design, photo galleries, or just to enhance content.
Images are inserted using the IMG
tag (note that we write img
, not the full word “image”). The IMG
tag is self-closing: <img />
, meaning it doesn’t require a closing tag.
HTML First Steps - Lesson 7 - Object Tag. Embedding Video from Youtube.
Quite often you need to embed a YouTube video into your blog. In this lesson, we’ll go over the tags and attributes used to do that. Let’s start by going to YouTube and copying the embed code for a video.
The resulting code looks like this:
HTML First Steps - Lesson 8 - Universal Tag Attributes
We’ve already talked about how different tags have their own specific attributes. Now it’s time to discuss the attributes that are common to many tags. Let’s look at the most popular ones.