Topic: Active Topics, New Posts, New Reply.. etc. as images

I can't seem to find how to replace several links with images.
Ideally I'd like to be able to change "New posts", "Active topics", "Unanswered topics", "New messages", "Post new Topic",  "Post Reply"....

With the hook "fn_generate_navlinks_end" it had been possible like so (example)

$links['index'] = '<li id="navindex"'.((FORUM_PAGE == 'index') ? ' class="isactive"' : '').'><a href="'.forum_link($forum_url['index']).'" title="Index"><img src="'.$ext_info['path'].'/img/navindex.png" alt="Index" /></a></li>';

[see navlinks extension for full code or this demo website for example]

Re: Active Topics, New Posts, New Reply.. etc. as images

yes nice idea for add custom buttons

Re: Active Topics, New Posts, New Reply.. etc. as images

Glad you agree, found some code in a old Rich Pedley Extension called Forum Fixes And Imgs (Beta) that adds the images with css....

Now I was trying to do the same but DROPPING the text link from lang/post.php  - but just deleting or changing text in post.php didn't work for me....

I'm trying to have the images (inserted with extensions imgs.css) replace the text

dirty version:


in viewforum.php

old line
$forum_page['page_post']['posting'] = '<p class="posting"><a class="newpost" href="'.forum_link($forum_url['new_topic'], $id).'"><span>'.$lang_topic['Post new topic'].'</span></a></p>';
   
HOW WOULD I DO THIS CORRECTLY VIA EXTENSION?   

new line
$forum_page['page_post']['posting'] = '<p class="posting"><a class="newpost" href="'.forum_link($forum_url['new_topic'], $id).'"></a></p>';


new additional stylesheeet

/imgs.css

.newpost, .newreply{
    padding-left: 90px;
    padding-top:3px;
}

.posting .newpost{
    background:transparent url(images/new_topic.gif) no-repeat center left;
}

.posting .newreply{
    background:transparent url(images/reply.gif) no-repeat center left;
}


extensions manifest.xml needs several lines like this (see extension link below for full code))

        <hook id="hd_head">
            <![CDATA[
            $forum_head[] = '<link rel="stylesheet" type="text/css" media="screen" href="'.$ext_info['url'].'/imgs.css" />';
            ]]>
        </hook>


       
based on
http://www.mediafire.com/file/zjywwo1uo … s_imgs.zip

4

Re: Active Topics, New Posts, New Reply.. etc. as images

KeyDog wrote:

HOW WOULD I DO THIS CORRECTLY VIA EXTENSION?

Well, I guess this should work fine (actually better, because you don't need any CSS and you have alt text before the images load wink):

<hook id="hd_visit_elements"><![CDATA[
if ($forum_user['may_post'])
    $forum_page['page_post']['posting'] = '<p class="posting"><a class="newpost" href="'.forum_link($forum_url['new_topic'], $id).'"><span><img src="'.$ext_info['path'].'/img/new_topic.png" alt="'.$lang_forum['Post topic'].'" /></span></a></p>';
else if ($forum_user['is_guest'])
    $forum_page['page_post']['posting'] = '<p class="posting"><a href="'.forum_link($forum_url['login']).'"><img src="'.$ext_info['path'].'/img/login.png" alt="'.$lang_common['login'].'" /></a> <a href="'.forum_link($forum_url['register']).'"><img src="'.$ext_info['path'].'/img/register.png" alt="'.$lang_common['register'].'" /></a></p>';
else
    $forum_page['page_post']['posting'] = '<p class="posting"><img src="'.$ext_info['path'].'/img/new_topic_no_permission.png" alt="'.$lang_forum['No permission'].'" /></p>';
]]></hook>

Just change those img names how you'd like them smile
BTW maybe if you don't plan to change images size too often you could add "width" and "height" attributes to those tags ;-)

Eraversum - scifi browser-based online webgame