This forum is for assistance with theme development.

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

Unble to View Admin Tools in Occy

Hi, I apologize for the double post, I just found this forum and it looked more appropriate. I have an active installation of Drupal and just added the Occy theme..but when I login under admin, there are no admin or configuration tools whatsoever.

Can anyone help? Thanks!!!

Pages

Subscribe with RSS Subscribe to RSS - Theme development