This forum is for assistance with theme development.

Drupal and BBClone

I'm trying to add a visitor counter to my web site powered by drupal. I thought to modify xtemplates and add the code for the counter. I use bbclone and the code to add is

define("_BBC_PAGE_NAME", $title);
define("_BBCLONE_DIR", "~/bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);

but I don't understand where to put this code (some where in xtemplates.theme). It should be on every page and $title should be the title or an identifier of the page.

thanks
Marco

Solution for multiple templates: Path templates "mxtemplate"

I've finally hacked my way to a solution for multiple templates. I have been modestly successful in assigning different templates based on the path. I will explore this solution further and if it seems worthy then I will try to develop a patch for the community to use. In the mean time here is an explanation of what I did along with some basic code examples.

Requirements:

  1. Drupal 4.4x
  2. Enable the path module
  3. Basic knowledge of PHP and some Drupal functions

Description:

I wanted to have the ability to display different layouts and possibly style sheets for pages within my site. To accomplish this I modified the path.module to include some additional data. I then modified the logic in xtemplate to look for the the new information.

  1. First, I created an additional column in the db table "url_alias (this is the table that stores path information). I called the new column "template" and I assigned it the same properties as "dst" and "src" (dst, src are columns in the url_alias table).
  2. Then I copied xtemplate and renamed it to mxtemplate. I also changed every reference to xtemplate to mxtemplate so that the system wouldn't freak out (m, for multiple xtemplates).
  3. Next I modified that path.module to include to include a pulldown menu (form_select) of the various themes available within the mxtemplate directory. I also modified several several functions within path.module (there are too many to talk about, but I will try to post the code below).
  4. Now that I had templates assigned to every path alias, I hacked the mxtemplate.theme file.
  5. Basically I wrote a function that compares the current pages path to the path alias stored in the db. If there is a match then it returns the assigned template directory. (see code below)

Code:

Here is a link to the code for the modified path.module. I haven't done a lot of testing of this, so PLEASE if you intend to use this BACK-UP your file.

phptemplate block.tpl.php, comment

Are there any examples available where people have added these files to their phptemplate theme? I'd really like to do block.tpl.php at the moment, but I'm a little uncertain of everything that I need in it. Thanks.

path alias variable

I've modified chameleon theme and want to be able to insert an image based on the path alias of the page that is displayed. What is the name of the variable which holds the path alias?

For example:

I have created a page with the path alias of overview. I have also created an image called overview.jpg stored in drupal/themes/chameleon/nav_images

In chameleon.theme file I want to insert:

$output .= "img src=\"themes/chameleon/nav_images/".$pathalias.".jpg\">\n";

so that an image with a name that matches the path alias will appear.

How hard is Drupal to theme?

I have a template made out already in HTML/PHP format http://www.atcork.com/beta/preview/check.php .
What I want to know is would it be possible to code a template around this design or am I wasting my time with Drupal as a backend. Are there any better Content management systems for the job?

Quest for multiple-templates

Over the past several days I've been immersed in hacking xtemplates. My goal was to assign templates based upon sections of the Web site. My first inclination was to assign styles based upon the vocabulary of the site, later I decided that for my purpose it would be better to assign styles based upon terms.

I've gotten as far as:

  1. Copying Xtemplages and renaming every reference
  2. Creating the necessary functions to access the "terms" stored in the DB. (wish that I had known about some of the functions in taxonomy.module before hand)
  3. Generating new forms in the theme manager [ /admin/system/themes/mxtemplate ] to assign specific templates to each term.

Where I was headed:

I was hoping to somehow pull the term (taxonomy) of the current page, and match it to the data that I had already collected. If there was a match, I was going to give the page a different style sheet. But I'm not sure if this is even feasible. I realized this when I started poking around more in the xtemplate code. Then I started looking at the URL's that Drupal generates and I realized that you can have multiple taxonomies displayed at the same time. Obviously I'm struggling to understand the different components of a drupal page that gets rendered to a browser.

Pages

Subscribe with RSS Subscribe to RSS - Theme development