This forum is for assistance with theme development.

Text to image addon almost implemented. Need some guidence on drupal conventions

Im making a small site for a friend, and we wanted to use a special font. I have implemented a function I have called txt2img. With this, one can get some text converted to a Only local images are allowed.-tag which points to a created img like this:

$text = "String from different places here";
txt2img($text, array(
  'font' => 'fontfile.ttf',
  'size' => '50',
  'color' => array(255,0,0) // makes a red colored text
  ...
); 

I was wondering if this is something I should contribute (I'll be happy to do so).

But I could use some guidence on integrating it with Drupal. It needs to locate font files, and be able to write to a directory which the user must have access to. Currently, I have made a "txt2img" with "cache" and "fonts" as subfolders. In "fonts" resides the .ttf fonts I want to use, the .png images are written to "cache". I suppose most users wouldn't want to bother to much with permissions, so a central location would be nice for the cache. Therefore I wanted to use the "files" directory in the site root. However, I wasn't able to read files from there. Is it possible to use it for this?

What naming should I use? I suppose most theme designers would want the function name to be small, that's why I called it txt2img() in the first place.

Where should I store the script-file(s)? I suppose a module wouldn't be very helpful for this. I solution may be to simply have the theme editors who want to use it bundle it up with their theme. That would ensure use of function names ++ corresponds.

Also, I need to get some information. What's the best way to get the following:
* Path to theme-directory (for "fonts" folder)
* Url path to the "cache"-folder (either in theme or files or...) for use in Only local images are allowed.-tag.

Thanks.

sliced bread snippets: Dynamic main page content without using extra modules...or putting "block" type content in the main page

Hey..

Have been trying to do this for a while: the ability to create dynamic pages without the need to install extra modules or being restricted to adding a new blocks which tend to be only available in the left or right columns.

THE THEORY

Blocks are great. But one of the drawbacks is that when a site begins to grow and more content is added, they tend to end up looking like a "kitchen sink" type link-fest. Where the left & right hand columns of blocks start getting very long and unsightly.....

By "kitchen sink"..I mean sites that are just one massive page full of links to everything and anything.

So, by allowing simpletons & newbies like me (who haven't got an expert eye for php or sql) to be able to generate dynamic main page content..(pulling information from the drupal database in the same way blocks do)...it enables us to move away from kitchen sink drupal sites and increasing the ergonomics and useability of a drupal site for visitors.

Thats the theory...and in practice, what I would like to do is kick off a new thread where we could build up some "sliced bread" php snippets repository for newbies like me..

php page snippet that lists all events in your drupal database

To kickstart the idea, here is a simple snippet I created earlier. It's very basic and very simple but it's an attempt at inserting the "upcoming events" listings that the event block generates and putting that into a page.

To implement it...follow these steps.

1. go to CREATE CONTENT - PAGE

2. paste in the following php snippet

3. Check the PHP code filter and Save the page.

<?php

/**
 * Creates a list of all the events in your drupal database
 * with a link to each event node. inended as a very simple illustration of what can be done.
 * 
 */
$gigssql = mysql_query("SELECT * FROM event");  // look in the event table in the drupal database
  while ($row = mysql_fetch_row($gigssql)) {
    $timestamp = $row[2];
    $gigdate= date("D M j G:i ", $timestamp); // formats the date of the event             
    print "<a href=\"node/$row[0]\">more details</a> --¦--  $row[1] --¦-- $gigdate <br />"; // outputs each event on an individual line with a link to more details.
    } 
?>

Hope that makes sense and nudges others who are as new to sql & php as I am to make the most out of the out-of-the-box drupal download rather than having to install and hack extra modules to get drupal to do what you want to do.

Dub

How to initialize variables in phptemplate themes

Hi,
I want to use my variable from new module in phptemplate.
Now I must add this variable to phptemplate.engine to function phptemplate_node(...)

function phptemplate_node($node, $main = 0, $page = 0) {
...
  $vars = array(
      ...
      'author'         => $node->author,
      ...
    );

Does anybody knowns how to make this variable working without changing this file? If possible to make it in module file?

Thank You

A few theme tweaks..

Is there any way to easily change the color for each categories news post?

Anyway to include a picture in the news story to tell the user which category the news story is (like phpnuke does)?

A way to include the users profile picture in the forum posts?
i.e. www.thinkattack.com/forum.php?forum=22&id=2466
(maybe even how many posts they have etc..)

Dropdown menu of taxonomy terms with related nodes?

Hi-

I'm trying to get a drop down menu going at the top of my client's site. They want the top of each drop down to be the terms in a certain taxonomy. Underneath the term should appear a list of nodes associated with that term.

I need symantic output.. using nested xHTML lists. I have no problem achieving the drop down effect once I get to that stage. I've looked all over for a function to use to create this. Do I really have to roll my own PHP to do this?

All I want is this...

Displaying a profile defined parameter in Node pages.

Hi,

I had created two profile parameters for my site users. And I would like to show them in the nodes posted by users.
It is a user name & company name, I would like to display something like:

Posted by: Tom Gonzales (Demo Enterprise)...
instead of
Posted by tmgzles...

Thanks in advance,
Luis

Pages

Subscribe with RSS Subscribe to RSS - Theme development