Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: NanoSector in Mai 19, 2012, 02:46:19 NACHMITTAGS

Titel: [Hack/SMF 2.0.x] Remove "Read xx times" from topic view *UPDATED*
Beitrag von: NanoSector in Mai 19, 2012, 02:46:19 NACHMITTAGS
This removes the Read counter from topic view and removes the Read columns from various lists and headers.
This package was made with the Curve theme in mind. It may not work correctly in other themes, nor will be updated to do so.

E.g. it replaces:
ZitatTopic: xxx (Read # times)

With just:
ZitatTopic: xxx
In the topic view.

Changelog
v0.2
+ Remove the count from the message index, thanks to CreativeITWorld.com :)

v0.3
+ Remove the Views column from the message index.

v0.4
+ Remove the Views column from the Unread Posts and Updated Topics pages, thanks to NewMoon :)

Package attached for easy install. Compatible with SMF 2.0.x.
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: NanoSector in Juli 09, 2012, 07:35:00 VORMITTAG
Also works in 2.1 Alpha as of now, for anyone interested.

Does anybody need to remove the counts from the topic index, too?
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: Mstcool in Juli 14, 2012, 11:28:52 NACHMITTAGS
You should submit this to the mod site
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: Antechinus in Juli 15, 2012, 12:08:46 VORMITTAG
Zitat von: Yoshi2889 in Juli 09, 2012, 07:35:00 VORMITTAG
Also works in 2.1 Alpha as of now, for anyone interested.

Does anybody need to remove the counts from the topic index, too?

If you have the participation column enabled:

.topic_table .table_grid thead tr td:nth-child(3), .topic_table .table_grid tbody tr td:nth-child(4)
{
    display: none;
}


If you have the participation column disabled:

.topic_table .table_grid thead tr td:nth-child(3), .topic_table .table_grid tbody tr td:nth-child(3)
{
    display: none;
}


:D
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: bigredinsider in Juli 15, 2012, 01:29:22 VORMITTAG
Got an error message when installing:

"Error in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF."



ok to continue?
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: Mstcool in Juli 15, 2012, 02:19:54 VORMITTAG
You can continue but make sure you back up your database and forum before clicking continue :P
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: NanoSector in Juli 15, 2012, 05:20:19 VORMITTAG
Zitat von: Mstcool in Juli 14, 2012, 11:28:52 NACHMITTAGS
You should put this in the mod site
if not can i post it and give all credits to u? i never made one and i just want to post one without making it

Ill give all credits to u :)
Thank you for the offer Mstcool, but I think this is just a little too small for being in the mod site (my Lock Recycled Topics mod already was too small methinks, lol)
I will submit it though, if people want me to do that, heh.
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: Mstcool in Juli 15, 2012, 07:58:43 NACHMITTAGS
Oh ok :)
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: ocmdiaz714 in September 03, 2012, 03:36:24 VORMITTAG
Any idea on how can I change "Read 1 times" to "Read 1 time"? And have it change to "times" once there's at least 2 views? Thanks.
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: NanoSector in September 05, 2012, 01:39:29 VORMITTAG
Zitat von: ocmdiaz714 in September 03, 2012, 03:36:24 VORMITTAG
Any idea on how can I change "Read 1 times" to "Read 1 time"? And have it change to "times" once there's at least 2 views? Thanks.
Sorry, I have no idea how to perform that. :(
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: Tony Reid in September 05, 2012, 03:48:13 VORMITTAG
not looked at the mod and dont need it - but for Yoshi - an example on doing something like that would be to use a conditional, something like....


echo 'total $hit '   . ($hit== 1 ? 'hit' : 'hits');




Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: NanoSector in September 05, 2012, 09:34:19 VORMITTAG
Zitat von: Tony Reid in September 05, 2012, 03:48:13 VORMITTAG
not looked at the mod and dont need it - but for Yoshi - an example on doing something like that would be to use a conditional, something like....


echo 'total $hit '   . ($hit== 1 ? 'hit' : 'hits');





I know how to do it, but I have no idea where it is set. (language files 'course but where in the sources)
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: Tony Reid in September 05, 2012, 09:36:59 VORMITTAG
Hmmm.. maybe just use substr to trim the S off the existing language string and then add an 's' in the conditional.

Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: tommoty in September 09, 2012, 07:42:57 VORMITTAG
 :D :D
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: CreativeITWorld.com in Oktober 24, 2012, 10:23:20 NACHMITTAGS
A handy little hack and just what I was looking for, except that I wanted a little more ... but thanks to your efforts, I started looking around for myself and added this little portion to your coding.

        <file name="$themedir/MessageIndex.template.php">
                <operation>
                        <search position="replace"><![CDATA[<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>]]></search>
                        <add><![CDATA[<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
</td>]]></add>
</operation>
        </file>


I hope it's of use to you and you can add this mod along with the rest of the mods.
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Beitrag von: NanoSector in Dezember 20, 2012, 03:19:18 VORMITTAG
Zitat von: CreativeITWorld.com in Oktober 24, 2012, 10:23:20 NACHMITTAGS
A handy little hack and just what I was looking for, except that I wanted a little more ... but thanks to your efforts, I started looking around for myself and added this little portion to your coding.

        <file name="$themedir/MessageIndex.template.php">
                <operation>
                        <search position="replace"><![CDATA[<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>]]></search>
                        <add><![CDATA[<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
</td>]]></add>
</operation>
        </file>


I hope it's of use to you and you can add this mod along with the rest of the mods.
Thanks CreativeITWorld, and sorry for my late reply.
I will add this in the mod today. First got school however so it's gonna take some time :)
Thanks!
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view *UPDATED*
Beitrag von: NanoSector in Dezember 21, 2012, 09:34:20 VORMITTAG
Updated the mod, thanks again CreativeITWorld.com :)
Titel: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view *UPDATED*
Beitrag von: NanoSector in Dezember 25, 2012, 05:06:26 NACHMITTAGS
Updated again, now is compiled with my Mod Creator and also removes the Views header and sorting method.
Titel: Re: [Hack/SMF 2.0.3] Remove "Read xx times" from topic view *UPDATED*
Beitrag von: NewMoon in Dezember 31, 2014, 08:28:18 NACHMITTAGS
Thanks so much for this mod!  Worked like a charm!

I discovered that one of the template (Recent.template.php) that shows unread posts since last visit, wasn't included.  I modified your file and installed it on my forum.  Works great!

Feel free to add it to your official install file for others to use as well.  Happy New Year! :)

    <file name="$themedir/Recent.template.php">
        <operation>
            <search position="replace"><![CDATA[<td class="', $color_class, ' stats windowbg">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>]]></search>
            <add><![CDATA[<td class="', $color_class, ' stats windowbg">
', $topic['replies'], ' ', $txt['replies'], '
</td>]]></add>
        </operation>
    </file>
Titel: Re: [Hack/SMF 2.0.3] Remove "Read xx times" from topic view *UPDATED*
Beitrag von: NanoSector in Januar 01, 2015, 05:21:10 NACHMITTAGS
Thanks NewMoon, happy new year to you too! :)

I'll add it to the package in a minute. I've also wrapped your code in [code][/code] tags in your post, so it's more easily readable.

Thanks again!
Titel: Re: [Hack/SMF 2.0.x] Remove "Read xx times" from topic view *UPDATED*
Beitrag von: NewMoon in Januar 02, 2015, 04:58:03 NACHMITTAGS
Zitat von: NanoSector in Januar 01, 2015, 05:21:10 NACHMITTAGS
Thanks NewMoon, happy new year to you too! :)

I'll add it to the package in a minute. I've also wrapped your code in [code][/code] tags in your post, so it's more easily readable.

Thanks again!

Thanks for fixing formatting in my post! :)

Also, I noticed another place where the View count is displayed but can't figure out the template.  It's the "Show new replies to your posts" page.  Any idea?
Titel: Re: [Hack/SMF 2.0.x] Remove "Read xx times" from topic view *UPDATED*
Beitrag von: NanoSector in Januar 02, 2015, 05:18:46 NACHMITTAGS
That's the same Recent.template.php file. It s hould be in another function in that same file.
Titel: Re: [Hack/SMF 2.0.x] Remove "Read xx times" from topic view *UPDATED*
Beitrag von: NewMoon in Januar 02, 2015, 06:46:34 NACHMITTAGS
The code is in two places in the template, but the search/replace should have taken care of it, I think, since it's identical.  I'm not familiar with SMF code or MODs so this is just me guessing.
Titel: Re: [Hack/SMF 2.0.x] Remove "Read xx times" from topic view *UPDATED*
Beitrag von: NanoSector in Januar 02, 2015, 06:47:22 NACHMITTAGS
The package manager only runs each operation once, then moves on to the next operation. I think it should be defined twice.
Will take care of  this later.