I wish for cutenews' next version is to have ALL THE HACKS added already and then, it's up to the administrator which of those he/she wants to use. Example, there's these check boxes of hacks or simply a list of hacks. When we want to add the hack in our cutenews, we just simply check the box/boxes accordingly.

A lot have been going through a rough time adding hacks because the codes mess up and sometimes, the codes just don't work. https://cutephp.com/forum/style_emoticons/default/smile.gif

It's not a hack if it's included.

2

(0 replies, posted in Hacks & Tricks / FAQ)

Name: Quoting comments.
Author: Ifa, (lkj), FUNimations, Spritanium
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: This was made in a group effort. This hack adds a "quote" button to each comment. When clicked upon, the text from the comment is added to the new comment textarea in quote tags with the HTML stripped. The HTML is stripped because otherwise, the HTML would show up as text and clutter up the comment. This won't work for comments in a popup.
Instructions:
Add this to the HEAD section of whatever page you show Cutenews on:

<script type="text/javascript">
function quote(element_id, textarea_id)
    {
        var textarea = null;
        var comment = null;
        
        if (document.getElementById)
            {
                textarea = document.getElementById(textarea_id);
                comment = document.getElementById(element_id).innerHTML;
            }
        else if (document.all)
            {
                textarea = document.all[textarea_id];
                comment = document.all[element_id].innerHTML;
            }
        else if (document.layers)
            {
                textarea = document.layers[textarea_id];
                comment = document.layers[element_id].innerHTML;
            }
        
        if (textarea)
            {
                textarea.focus();
                var text = textarea.value + " " + "[quote]" + comment + "[/quote]";
                textarea.value = text.stripHTML();
                textarea.focus();
            }
    }
String.prototype.stripHTML = function()
{
        // What a tag looks like
        var matchTag = /<(?:.|\s)*?>/g;
        // Replace the tag
        return this.replace(matchTag, " ");
};
</script>

Now, go to your comments template and put div tags around {comment} with an id of "a{comment-id}", like so:

<div id="a{comment-id}">
{comment}
</div>

(The "a" before {comment-id} is there because in (X)HTML, a number can't begin an id attribute.)

Next, add this to your comments template:

<input type="button" value="Quote" onclick="java script:quote('a{comment-id}', 'commentsbox')" />


(Make sure your comment box's id is "commentsbox". It is by default, but some people might change it for whatever reason. Also make sure that you change "java script" to "javascript" (one word). This forum censors it.)

You're done!  https://cutephp.com/forum/style_emoticons/default/laugh.gif