Theming is presently supported by functions, this request is to allow (and test) themable templates so that users can create/edit their own *.tpl.php file to truly configure Classified Ad display exactly as they'd like.

Comments

jamesialford’s picture

I would love this. I have been working on this for weeks and can not get a good theme to work. realy, all I want is to add a Button on the right for the picture "Buy Now" this will send out a Privite Message to the seller.

Any help would be great.

James

jamesialford’s picture

Miles, I will be more then happy to help out testing this. I have several sites that I am using for testing.

James

milesgillham’s picture

I feel a little badly about this item. I created it before I had understood more about ed_classified and theming. It really is more of a todo item to test more aspects of theming for frills, bells, whistles.

See #591670: Overwritting standard ad display (list) and #460436: Classified ads node tpl not working.

Copy node.tpl.php to node-ed_classified.tpl.php in your theme directory. Remember that ed_classified does not use a different base type, it's just a node with benefits. You're going to want to be able to pull out the node owner and other details so that your links/rules have the right params. Doing a node_load on $nid should see you right (e.g. $node = node_load($node->nid);) Obvious ones already present include: $nid, $uid, $node

Use something like this to see what variables you have available if you're not sure:

<?php
print '<pre>';
print htmlspecialchars(print_r(get_defined_vars(), TRUE), ENT_QUOTES);
print '</pre>';
?>

Is that helpful?

Cheers,

Miles

jamesialford’s picture

Thank you Miles, In your opion would you use 6.x-2.0-alpha6 or the bata version. I know sometimes the bata version is the same but, with a few updates. Is this one of these times?

James

milesgillham’s picture

At this time the latest recommended version is alpha6.

Cheers,

Miles

jamesialford’s picture

Miles, I am using the alpha4 version.

I would like to document my process so, anyone who is having trouble can find it.

Here is where I am standing. I renamed the node.tpl.php to node-ed_classified.tpl.php in my theme directory sites/all/themes.

I can add things to the node-ed_classified.tpl.php it will change the classified ads.

I have rules and links installed. I have not done much with them yet. I do not know much about these two modules. I am reading the documents before I work on them. If you know of some thing that will help us out, Please post it.

I will post more after I am finished reading.

James

milesgillham’s picture

@James:

Just with respect to the wording of your documentation - I hope you copied not moved node.tpl.php to node-ed_classified.tpl.php or bad things might happen to the rest of your nodes. Do you mean, sites/all/themes or sites/all/themes/ where you did this? That is, the name of your currently active theme?

You may need to occasionally flush your caches for changes to show up (I expect you already know this, just a warning to others as sometimes we all forget).

Upgrade to the alpha6 version if you can. It's better.

Cheers,

Miles

jamesialford’s picture

Miles, Yes I copied the node-ed_classified.tpl.php to the sites/all/themes/mytheme directory.

flush the caches I do almost every time I do some coding updates. Here are the steps for the people needing it:
Goto admin/settings/performance
Under the "Clear cached data" click the button for "Clear cached data"
You are done.

James

jamesialford’s picture

I am at the alpha6 version now.

jamesialford’s picture

Miles, I do not see where to pull out the node owner and other details. Can you advise?

Here is my node-ed_classified.tpl.php

<?php // $Id: node.tpl.php,v 1.1 2009/07/03 07:40:11 agileware Exp $ ?>
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?> Post">
  <div class="Post-tl"></div>
  <div class="Post-tr"></div>
  <div class="Post-bl"></div>
  <div class="Post-br"></div>
  <div class="Post-tc"></div>
  <div class="Post-bc"></div>
  <div class="Post-cl"></div>
  <div class="Post-cr"></div>
  <div class="Post-cc"></div>
  <div class="Post-body">
    <div class="Post-inner">
      <?php if ($teaser): ?>
        <h2 class="PostHeaderIcon-wrapper"> <span class="PostHeader"><a href="<?php echo $node_url; ?>" title="<?php echo $title; ?>"><?php echo $title; ?></a></span></h2>
      <?php endif; ?>
      <div class="PostHeaderIcons metadata-icons">
        <?php if ($submitted) { echo art_submitted_worker($submitted, $date, $name);} ?>
      </div>
      <div class="PostContent">
        <div class="article">
          <?php echo $content;?>
          <?php if (isset($node->links['node_read_more'])) { echo '<div class="read_more">'.get_html_link_output($node->links['node_read_more']).'</div>'; }?>
        </div>
      </div>
      <div class="cleared"></div>
      <div class="PostFooterIcons metadata-icons">
        <?php if (!empty($links)) { echo art_links_woker($node->links);} ?>
        <?php if (!empty($terms)) { echo art_terms_worker($node);} ?>
      </div>
    </div>
  </div>
</div>
doerno’s picture

Thank you Miles.

Purnomo

fgm’s picture

Status: Active » Fixed

@amesialford gave a solution on #10 to theme Classified Ads nodes.

More generally, themability has been simplified in 6.x-3.x: theme functions have been replaced by templates for the expiration "widget" on nodes, and it can also be moved within the node rendering without having to code by using CCK Build modes at admin/content/node-type/classified/display/classified for ads lists, and at admin/content/node-type/classified/display for normal displays.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.