I would like to replace many text-links such as "read-more", "post-comments", "reply" .... with some buttons.
Can this be done in the theme? Where would I start?

Andre

Comments

slayerment’s picture

You can do this by editing your node.tpl.php template file. You can then theme your node however you want and make your images point to where the text links used to point.

andre75’s picture

Tha part that does the links in my node-forum.tpl.php looks like this:

    <?php print $links ?>

So I guess I have to take apart the array $links. But since I am not a php-guy I was hoping someone had done this already.

Andre

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

slayerment’s picture

If you look at the URL for one of the links like say "Add New Comment" you will see that the path is: /comment/reply/117 or whatever the node ID is. You can then simply have your image be like:

print '<a href="/comment/reply/'.$node->nid.'"><img src="path" /></a>';

Hopefully that can get you started. You don't even need to use the $links variable.

andre75’s picture

Yeah, I get it now. Thanks for the tip. I think this is starting to get somewhere now.
I can defenitely see something going on.

The actual links are something like this:

EDIT: Nevermind, I looked at comment.module:

For comments:

<a href="comment/reply/<?php print $comment->nid ?>/<?php print $comment->cid ?>"><img src="files/buttons/reply.gif">

For the first post:

<a href="comment/reply/<?php print $node->nid ?>#comment"><img src="files/buttons/reply.gif">

Just need to seperate them apart with an if or something. Wow, this is easier than I though.

Thanks a whole bunch.

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

andre75’s picture

I just learned php in 5 minutes, or did I?

Anyways, this is what a php illiterate came up with:

<?php if ($node->nid) : ?>
<a href="comment/reply/<?php print $node->nid ?>#comment"><img src="files/buttons/reply.gif"></a>
<?php endif; ?>
<?php if ($comment->cid) : ?>
<a href="comment/reply/<?php print $comment->nid.'/'.$comment->cid ?>"><img src="files/buttons/reply.gif"></a>
<?php endif; ?>

You may laugh at this now, but it works !

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

slayerment’s picture

Good job man, that's all there is to it :).

andre75’s picture

Just figured out how to decide wether or not to show the edit and delete buttons ;-)

I had asked about buttons before and never got an answer.

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

anandsueman’s picture

i have a problem locating the footer div , i need it not to be nested in the conten div
i have looked at the page.tpl.php

 <body <?php
        print "class=\"$body_class sb-$layout\" id=\"$body_id\"";
        print theme("onload_attribute"); ?>
        >
        <div id="top-nav">
            <?php if (is_array($primary_links)) : ?>
            <?php $i=0; ?>
            <ul id="primary">
                <?php foreach ($primary_links as $link): ?>
                <?php $i=$i+1; ?>
                <?php if ($i==count($primary_links)) print ('<li class="last">');
                else print ('<li>');
                ?>
                <?php print $link?></li>
                <?php endforeach; ?>
            </ul>
            <?php endif; ?>
            <?php if (is_array($secondary_links)) : ?>
            <ul id="secondary">
                <?php foreach ($secondary_links as $link): ?>
                <li>
                <?php print $link?></li>
                <?php endforeach; ?>
            </ul>
            <?php endif; ?>
        </div>
        <div id="page_wrapper">
            <div id="header">
                <?php if ($logo) : ?>
                <div id="sitelogo">
                <a href="<?php print url() ?>" title="Index Page">
                <img src="<?php print($logo) ?>" alt="Logo" /></a>
                </div>
                <?php endif; ?>
                <?php if ($search_box): ?>
                    <div id="search">
                        <form action="<?php print url("search") ?>" method="post">
                        <input class="form-text" type="text" size="15" value="" name="keys" />
                        <input class="form-submit" type="submit" value="<?php print t("Search")?>" />
                        </form>
                    </div>
                <?php endif; ?>
                <?php if ($site_name) : ?>
                <h1 id="site-name">
                    <a href="<?php print url() ?>" title="Index Page">
                        <?php print($site_name) ?></a></h1>
                <?php endif;?>
                <?php if ($site_slogan) : ?>
                <div id="site-slogan">
                    <?php print($site_slogan) ?>
                </div>
                <?php endif;?>
                <?php $mission = theme_get_setting('mission', false); ?>
                <?php if ($mission != ""): ?>
                <p id="mission">
                    <?php print $mission ?>
                </p>
                <?php endif; ?>
                <br class="clear" />
            </div>
            <div id="wrapper">
                <?php if ($sidebar_left != ""): ?>
                <div id="sidebar-left">
                    <?php print $sidebar_left ?>
                </div>
                <?php endif; ?>
                <div id="main-content" class="content <?php echo $layout;?>">
                    <div class="w1"><div class="w2"><div class="w3"><div class="w4">
                            <?php if ($breadcrumb != ""): ?>
                            <?php print $breadcrumb ?>
                            <?php endif; ?>
                            <?php if ($title != ""): ?>
                            <h2 class="content-title">
                                <?php print $title ?></h2>
                            <?php endif; ?>
                            <?php if ($tabs != ""): ?>
                            <?php print $tabs ?>
                            <?php endif; ?>
                            <?php if ($help != ""): ?>
                            <p id="help">
                                <?php print $help ?>
                            </p>
                            <?php endif; ?>
                            <?php if ($messages != ""): ?>
                            <div id="message">
                                <?php print $messages ?>
                            </div>
                            <?php endif; ?>
                            <!-- start main content -->
                            <?php print($content) ?>
                            <br />
                            <!-- end main content -->
                    </div></div></div></div>
                </div>
                <?php if ($sidebar_right != ""): ?>
                <div id="sidebar-right">
                    <?php print $sidebar_right ?>
                </div>
                <?php endif; ?>
            </div>
        </div>
      
        <?php print $closure;?>
		
    </body>

this is what i see online from my source code

!-- begin content -->
<div class="node">
 <div class="content">
<p>Pelosa Network Engineering BV is een succesvol Nederlands bedrijf dat sinds 1995 gespecialiseerd is in de ontwikkeling en implementatie van branchespecifieke software die belangrijke bedrijfsprocessen automatiseert. Wij hebben ons met name toegelegd op de <a href="http://www.pelosa.nl/content/?q=clearview_main" title="schoonmaakbranche">schoonmaakbranche</a>, op de <a href="http://www.pelosa.nl/content/?q=oasys_main" title="oppervlaktebehandelende industrie">oppervlaktebehandelende industrie</a> en op de <a href="http://www.pelosa.nl/content/?q=planrad_main" title="kinderopvang">kinderopvang</a>. Voor deze branches hebben wij <strong>speciale</strong> softwarepakketten ontwikkeld.</p>

<p>De <strong>branchespecifieke software</strong> van Pelosa is generiek en sluit vrijwel altijd naadloos aan bij uw specifieke bedrijfsproces, waardoor u <strong>snel optimaal rendement</strong> binnen uw organisatie kunt behalen.</p>

<p>Onze branchespecifieke benadering geeft een voorsprong op standaardoplossingen. Pelosa software is <strong>herkenbaar</strong> door de gebruikte termen en begrippen en daardoor <strong>eenvoudig</strong> en <strong>toegankelijk</strong> voor iedereen binnen een bedrijf. Hierdoor kunnen wij een op maat gesneden oplossing aanbieden. Deze oplossingen variëren van taakgerichte oplossingen (voor bijvoorbeeld planning of facturatie) tot <strong>totaaloplossingen</strong> (voor de automatisering van de gehele bedrijfsadministratie en bedrijfsprocessen).</p> </div>

 <div class="links"><a href="?q=emailpage&amp;nid=1" title="Email this page to a friend">email deze pagina</a></div>
</div>

<!-- end content -->
 <div id="footer">(c) 2006 Pelosa Network Engineering, Zoetermeer</div>
   </td>
   <td id="sidebar-right"><div class="block block-search" id="block-search-0">
 <h2 class="title">Zoeken</h2>
 <div class="content"><form action="?q=search/" method="post">

 <div class="search-form"><div class="form-item">
 <div class="container-inline"><div class="form-item">
 <input type="text" maxlength="255" class="form-text" name="edit[keys]" id="edit-keys" size="20" value="" />
</div>
<input type="submit" class="form-submit" name="op" value="Zoeken"  />
</div>
</div>
</div>
</form>
</div>
</div>
<div class="block block-simplenews" id="block-simplenews-newsletter-32">
 <h2 class="title">Pelosa Nieuwsbrief</h2>

 <div class="content"><div class="sn-message">Blijf geïnformeerd over het laatste nieuws van Pelosa!</div><form action="/" method="post">
<div class="sn-block"><div class="form-item">
 <label for="edit-sn_email_32">E-mailadres:</label><br />
 <input type="text" maxlength="35" class="form-text" name="edit[sn_email_32]" id="edit-sn_email_32" size="20" value="" />
</div>
<div class="form-item">
 <label class="option"><input type="radio" class="form-radio" name="edit[sn_subscribe_32]" value="Subscribe" checked="checked" /> Meld aan</label><br /><label class="option"><input type="radio" class="form-radio" name="edit[sn_subscribe_32]" value="Unsubscribe" /> Meld af</label><br />

</div>
<input type="submit" class="form-submit" name="sn_32" value="Indienen"  />
</div>
</form>
</div>
</div>
<div class="block block-event" id="block-event-1">
 <h2 class="title">Activiteiten</h2>
 <div class="content"><div class="item-list"></div><div class="ical-link"><a href="webcal://pelosa.project-8.nl/?q=event/ical" title="Add this calendar to your iCalendar"><img src="modules/event/images/ical16x16.gif" alt="Add to iCalendar" /></a></div><div class="more-link"><a href="?q=event" title="More events.">meer</a></div></div>
</div>
<div class="block block-user" id="block-user-3">
 <h2 class="title">Wie is online</h2>

 <div class="content">Er zijn momenteel 0 users en 0 gasten online.</div>
</div>
</td>
  </tr>
 </table>
 </body>
</html>

please not where the footer div is ,
take a look at http://pelosa.project-8.nl

how do i get the footer div out of the content div ????

heine’s picture

First of all, best to post this in a new thread with a proper title; this will allow more people to eyeball your post. The comments in page.tpl.php and the page source do not seem to match; did you select the right page.tpl.php?

What version of Drupal do you use? What theme?

-- // --

Om te beginnen kun je dit het beste in een nieuw draadje met een passende titel posten; de kans is dan groter dat iemand reageert.

Het valt me op dat de commentaren in page.tpl.php (

) en de bron van de pagina ( !-- begin content --> ) niet overeenkomen. Ik vraag me af of je wel de juiste page.tpl.php te pakken hebt. Welke drupal versie & welk thema gebruik je?

--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

anandsueman’s picture

drupal 4.6 wordt gebruikt,
ik heb op dit moment 2 page.tpl in de map structuur heb hun beide dezelfe gemaakt waarbij de footer onderaan valt
de thema die ik gebruik is cameleon en heb heb het aan gepast.
je kan kijken op http://pelosa.project-8.nl

zal ik dit probleem dan toevoegen aan een nieuwe thread ???

heine’s picture

New thead at http://drupal.org/node/57566
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

andre75’s picture

LOL. My poor little thread got kidnapped :-(.
I was actually going to have more questions here.
Theming of the forums is going well with the above mentioned approach, but I guess I will restart, since I have two many if clauses.
First off, one needs to find out if the user is logged in and then decide for each button wether to display it or not (e.g. edit button). And then if its the admin itself change comment/edit to admin/comment/edit.

This is a lot of work and the thing becomes bloated. I found the section where $links is created in comment.module. I guess I can simply override those. Lets see.

Andre

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

crick’s picture

andre,

i am also trying to get a respectable forum out of the drupal forum module. one thing i noticed that yourself and others have been able to do is make the initial post look the same as the replies. and instead of it having a link to "add new comment" it has a link to "reply" I'm having trouble finding information on how to change this. i was hoping that since you have achieved this, you might be able to point me in the right direction.

andre75’s picture

I just had a breakthrough, check it out:

http://www.opentravelinfo.com/node/342

I actually did something different. I replaced everything with graphical buttons. Until 5 minutes ago I did have "add new comment" and "reply" on my forums, so I am wondering if you are psychic or something since you posted before I had it online :-)

I replaced all links with buttons. No more ugly text links for me. I have just one button for "add new comment" and for "reply" so the difference between the first and all subsequent posts is transparent.
I still need to check a bunch of things out. I will post my solution in the handbook and the link here for you when I am done.

Next big thing on the forum is to make the rest of it look good.

Andre

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

crick’s picture

haha, maybe i just missed the "add new comment" or it wasnt there because i wasnt logged in? who knows. but i'm glad you got it working now. I think that you will be helping out alot of people by posting a good how-to in the handbook for this. Thanks for the help. btw, your forum is looking good with those buttons.

andre75’s picture

I will take care of it next week. I had the most horrific weekend ever. I fought for 48 hours for the life of my beloved cat Tigger who almost died. He still isn't out of the woods. He is pumped up on steroids, 2 different Antibiotics and potassium now. I am very exhausted now, but I will post next week, promise.

Andre

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

chrisd’s picture

Andre hope you can make it back soon...

Tech. articles with a WAMP+IIS+Drupal focus

Take a break: Guide to France

andre75’s picture

Been back for a while now. I guess I just forgot this thread. Had to put my good buddy down. That was a tough decision.
I got my forum styled very nicely now. I am pretty happy with the drupal forum. Now I am having some trouble with Site5 again, since opentravelinfo runs very slow :-(

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com