This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

The skinny on xtemplate: Need more info

I need to know more about xtemplate and how it adds information and parses it. I'm developing a page shell module and I need to modify xtemplate so that it renders the shells correctly.

Ideally I would like to create a new function(s) within xtemplate that parses my information. Then within the xtemplate.xtmpl file I could add a new subsitution tag for page shells, {shell}.

Can anyone point me in the right direction?

I wasn't able to figure this out so I modified the _page function so that the $content variable was wrapped in an "if" statement. The "if" statement checked the type of the node and if it was a shell then it rendered my shell content instead of the node content. This almost worked, however the _page function doesn't get the $node information passed to it. So I had to call the node information using node_load. This method prints my content, but it also generates a permissions error.

In addition to modifying the _page function. I also tried putting an if statement within the _node function which checked the type and then tried to add the shell information to the node. For example taxonomy is added to the node variable, and so is avatar. I tired to add shell to the node variable using assign() and parse() but I was unsuccessful. Does anyone know how to do this?

Thanks, - Strayhand

How do I submit varibles that the settings file of of my module created to the database?

Does any one know how to make it so that I can set settings in my module settings bit, and then have the setting commited to database?#

thanks

Mr Maggoo

user->name and similar varibles. Is there a list?

Is there a list for the user->name and user->uid sort of varibles?

mysql-specific modification to archive.module for monthly listings with entry counts

this is a more efficient version of archive_calendar_listing that is mysql-specific. it also displays the total post count for each month:

function archive_calendar_listing_mysql() {
  $cache = cache_get("archive:calendar:listing");
  if (!empty($cache)) {
    return $cache->data;
  }

  $months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t
("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 =>
 t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));

  $sql = "
    SELECT SUBSTRING(FROM_UNIXTIME(created), 1, 7) as date, COUNT(*) as count
    FROM   {node}
    WHERE  status = 1
    GROUP  BY date DESC
  ";

  $count = variable_get("archive_months", 0);
  if ($count) {
    $sql .= " LIMIT $count";
  }

  $result = db_query($sql);

  while ($month = db_fetch_object($result)) { 
    list($y, $m) = explode('-', $month->date);
    $mname = $months[intval($m)];
    $items[] = l("$mname $y", "archive/$y/$m") . " (" . $month->count . ")";
  }
  $output = theme("item_list", $items); 

  cache_set("archive:calendar:listing", $output);

  return $output;
}

_insert / _delete / _update hooks not being called?

Hi All! I'm working on a new module intended for my Drupal 4.4.x system. So I thought I would follow the recommendations of using these hooks instead of _nodeapi. However, for some reason they are NOT being called. Any tips on how to diagnose / correct this problem are appreciated!

Radi

How to read / write to database w/ drupal

Our web site is based on drupal 4.3.1. I put regular updates into a set of manually updated static pages that are linked to from the main menu. My goal has always been to write / modify a module that will handle the updates section for me automatically so that i can delegate the task of adding updates to another department. Here is what I envision:

Utilizing the standard node creation method, when the node is created a copy of the node index number would be kept in a seperate "updates" table to identify which nodes are updates.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions