Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
Modifying News & Sections articles by removing "Posted by" and "Reads"/"total words"
  • Posted: 27.10.2007, 04:26
     
    Carogue
    rank:
    Freshman Freshman
    registered:
     April 2007
    Status:
    offline
    last visit:
    19.11.08
    Posts:
    23
    Hello & thanks for reading!

    After sifting through a variety of posts with advice and instructions for removing some of the note/counter items included with posted articles, I have figured out, I think, where the code that must be modified is located. But I need help with the code itself because I am not proficient enough in PHP. So, those who love to code, here you go! I am relying on your expertise.

    First, I am running PN 764 with ExtraLite theme.

    To remove the "Posted by" XX "on" DATE-TIME information from my News articles, I looked in the theme directory -- specifically: themes/ExtraLite/theme.php.

    There I find the following (lines 122-152):

    Code

    {
        echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color:$GLOBALS[bgcolor5]\" width=\"100%\"><tr><td>\n" .
             "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\"><tr><td style=\"background-color:$GLOBALS[bgcolor1]\">\n" .
        "<h2>$preformat[catandtitle]</h2>\n" .
        _POSTEDBY . ": $info[informant] " . _ON . " $info[longdatetime]\n";
        if (!empty($links['searchtopic'])) {
            echo "<br /><a href=\"$links[searchtopic]\">$info[topicname]</a>&nbsp;\n";
        }
        echo "</td></tr>\n" .
             "<tr><td style=\"background-color:$GLOBALS[bgcolor1]\">\n" .
             "$info[hometext]\n<br /><br />$preformat[notes]\n<br /><br />\n" .
             "</td></tr>\n" .
             "<tr><td style=\"background-color:$GLOBALS[bgcolor1];text-align:right\">\n" .
             "<span class=\"pn-sub\">$preformat[more]</span>\n" .
             "</td></tr></table>\n" .
             "</td></tr></table>\n" .
             "<br />";
    }

    function themearticle ($_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $info, $links, $preformat)
    {
        echo"
        <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"text-align:left;background-color:$GLOBALS[bgcolor5];width:100%\"><tr><td>\n
        <table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" style=\"width:100%\"><tr><td style=\"background-color:$GLOBALS[bgcolor1]\">\n
        <h2>$preformat[catandtitle]</h2>\n
    <span class=\"pn-sub\">"
    . _POSTEDBY . ": $info[informant] " . _ON . " $info[briefdatetime]</span>\n";
        if (pnSecAuthAction(0, 'Stories::Story', "$info[aid]:$info[cattitle]:$info[sid]", ACCESS_EDIT)) {
            echo "&nbsp;&nbsp; [ <a href=\"admin.php?module=AddStory&amp;op=EditStory&amp;sid=$info[sid]\">" . _EDIT . "</a> ]";
            if (pnSecAuthAction(0, 'Stories::Story', "$info[aid]:$info[cattitle]:$info[sid]", ACCESS_DELETE)) {
                echo " [ <a href=\"admin.php?module=AddStory&amp;op=RemoveStory&amp;sid=$info[sid]\">" . _DELETE . "</a> ]";
            }


    How, exactly, should I edit this to eliminate the two functions?

    Part deux: Articles posted in Sections include a "Reads" counter and a "total words in this text" counter. To eliminate those, you have to look in modules/Sections/index.php, according to other posts.

    Here is what I have (lines 162-165):

    Code

    echo '<li><a href="index.php?name=Sections&amp;req=viewarticle&amp;artid='.pnVarPrepForDisplay($artid).'&amp;page=1">'.pnVarPrepForDisplay($title).'</a> ('.pnVarPrepForDisplay($counter).' '._READS.')'
                    .'&nbsp;<a href="index.php?name=Sections&amp;req=viewarticle&amp;artid='.pnVarPrepForDisplay($artid).'&amp;allpages=1&amp;theme=Printer">'
                    .'<img src="modules/'.pnVarPrepForOS($GLOBALS['name']).'/images/print.gif" alt="'._PRINTER.'" /></a>'
                    .'</li>';


    How should this be edited? (I would leave the Printer function, if possible.)

    I hope your responses will help other newbies -- and I'm sure I'll be enlightened!

    Catherine

  • Posted: 27.10.2007, 04:50
     
    nestormateo
    rank:
    Professional Professional
    registered:
     September 2006
    Status:
    online
    Posts:
    1451
    Well Catherine,
    Let me say that if you want a customized theme you should look to a Xanthia / AutoTheme one. Remove this details at the News articles is just modify some htm templates without touch a PHP file...

    but well, if you want just to practice, you can:
    Remove the _POSTED_BY phase and container if exist:

    Code

    _POSTEDBY . ": $info[informant] " . _ON . " $info[longdatetime]\n"

    <span class=\"pn-sub\">" . _POSTEDBY . ": $info[informant] " . _ON . " $info[briefdatetime]</span>\n"



    Part deux: icon_smile
    Unfortunately, Sections is a old-style module, and need to be hacked in the PHP files... you can change it for the htmlpages module, templated and 'better than' Sections. But well, just follow your instinct and delete:

    Code

    ('.pnVarPrepForDisplay($counter).' '._READS.')'

    Be care to close the ' if needed.


    Fortunately, 0.8 release is fully templated and you can modify all that you want in the htm files.
    Happy PostNuking! icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Posted: 29.10.2007, 02:13
     
    Carogue
    rank:
    Freshman Freshman
    registered:
     April 2007
    Status:
    offline
    last visit:
    19.11.08
    Posts:
    23
    Thank you for the response and information, Mateo.

    However, when I delete the two lines you indicated in the theme.php file and refresh my site, I get this error:

    Parse error: syntax error, unexpected T_IF in /home/SITE NAME/public_html/themes/ExtraLite/theme.php on line 126

    Am I still not deleting correctly?

    In Part Deux, the Sections/index.php, I also get an error when I delete the line:

    Parse error: syntax error, unexpected '



    edited by: Carogue, Oct 30, 2007 - 04:30 PM
  • Posted: 29.10.2007, 02:18
     
    Carogue
    rank:
    Freshman Freshman
    registered:
     April 2007
    Status:
    offline
    last visit:
    19.11.08
    Posts:
    23
    Unexpectedly lost the last part of my post!

    The parse error was an unexpected angle bracket.

    Obviously, I am omitting something critical when I delete the code. Any ideas or further guidance?

    I have the upgrade to 0.8 on my list -- but making these changes would be a great help at present.

    Thanks,
    Catherine
  • Posted: 30.10.2007, 21:29
     
    Carogue
    rank:
    Freshman Freshman
    registered:
     April 2007
    Status:
    offline
    last visit:
    19.11.08
    Posts:
    23
    A quick update on my progress:

    In the theme.php file, after trial/error, I finally removed a small part of the code that does remove the datetime on the themeindex files:

    Around line 126 for me -- I removed this bit:

    Code

    . _ON . ":$info[longdatetime]"


    Unfortunately, this doesn't work with the bit just previous (_POSTEDBY segment). Nor does it work on the Sections/index.php code for _READS.

    But nothing else seems broken since I removed it, so that's something!

  • Posted: 30.10.2007, 21:58
     
    nestormateo
    rank:
    Professional Professional
    registered:
     September 2006
    Status:
    online
    Posts:
    1451
    Ok, let's modify your initial code:
    Textually you can replace with:

    Code

    {
        echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color:$GLOBALS[bgcolor5]\" width=\"100%\"><tr><td>\n" .
             "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\"><tr><td style=\"background-color:$GLOBALS[bgcolor1]\">\n" .
        "<h2>$preformat[catandtitle]</h2>\n";
        if (!empty($links['searchtopic'])) {
            echo "<a href=\"$links[searchtopic]\">$info[topicname]</a>&nbsp;\n";
        }
        echo "</td></tr>\n" .
             "<tr><td style=\"background-color:$GLOBALS[bgcolor1]\">\n" .
             "$info[hometext]\n$preformat[notes]\n\n" .
             "</td></tr>\n" .
             "<tr><td style=\"background-color:$GLOBALS[bgcolor1];text-align:right\">\n" .
             "<span class=\"pn-sub\">$preformat[more]</span>\n" .
             "</td></tr></table>\n" .
             "</td></tr></table>\n" .
             "";
    }

    function themearticle ($_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $info, $links, $preformat)
    {
        echo"
        <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"text-align:left;background-color:$GLOBALS[bgcolor5];width:100%\"><tr><td>\n
        <table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" style=\"width:100%\"><tr><td style=\"background-color:$GLOBALS[bgcolor1]\">\n
        <h2>$preformat[catandtitle]</h2>\n"
    ;
        if (pnSecAuthAction(0, 'Stories::Story', "$info[aid]:$info[cattitle]:$info[sid]", ACCESS_EDIT)) {
            echo "&nbsp;&nbsp; [ <a href=\"admin.php?module=AddStory&amp;op=EditStory&amp;sid=$info[sid]\">" . _EDIT . "</a> ]";
            if (pnSecAuthAction(0, 'Stories::Story', "$info[aid]:$info[cattitle]:$info[sid]", ACCESS_DELETE)) {
                echo " [ <a href=\"admin.php?module=AddStory&amp;op=RemoveStory&amp;sid=$info[sid]\">" . _DELETE . "</a> ]";
            }



    Part deux:

    Code

    echo '<li><a href="index.php?name=Sections&amp;req=viewarticle&amp;artid='.pnVarPrepForDisplay($artid).'&amp;page=1">'.pnVarPrepForDisplay($title).'</a> '
                    .'&nbsp;<a href="index.php?name=Sections&amp;req=viewarticle&amp;artid='.pnVarPrepForDisplay($artid).'&amp;allpages=1&amp;theme=Printer">'
                    .'<img src="modules/'.pnVarPrepForOS($GLOBALS['name']).'/images/print.gif" alt="'._PRINTER.'" /></a>'
                    .'</li>';


    Sorry, my reply was without time and i just give you some light...
    when you're modifying PHP you have to take care of not corrupt the syntaxis (take a look to the color distinction in the code, the strings must be red, and the logic green).


    The previous code is now full corrected.
    Try it (paste with care icon_wink )
    See ya

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Posted: 31.10.2007, 20:24
     
    Carogue
    rank:
    Freshman Freshman
    registered:
     April 2007
    Status:
    offline
    last visit:
    19.11.08
    Posts:
    23
    Hey, Mateo -- You rock!!

    I replaced the code in the theme.php file and it worked perfectly. Thank you so much for taking the time on it.

    The code for the Sections/index.php file is still giving me errors -- but I will keep trying. Perhaps it's something that I'm causing when I do the replacement. I'll look at it carefully.

    But I'm so happy with the results on the theme.php modifications -- can't thank you enough for the assistance.

    Have a great day!

    Catherine
  • Posted: 31.10.2007, 20:47
     
    nestormateo
    rank:
    Professional Professional
    registered:
     September 2006
    Status:
    online
    Posts:
    1451
    Nice Catherine! icon_smile
    I recommend you to get familiar with Xanthia in favor to the 0.8 release.
    Modifications in the templates are pretty easy to do.

    Have a great day too!
    see ya

    --
    - Mateo T. -
    Mis principios... son mis fines

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula