Welcome to Geeklog Sunday, August 25 2019 @ 08:56 pm EDT

Geeklog Forums

Remove What's Related/Options blocks...


Status: offline

griffman

Forum User
Junior
Registered: 23/04/02
Posts: 28

I'm building a two-column replacement for my current site's three-column display. All was looking good, except for articles that had "Read More" links. When I viewed the full text of the article, I would get three columns - the left side blocks, the article/comments block, and two blocks on the right side. One of these is the "What's Related" block, the other is the "Story Options" block. I wanted them gone. With some help (OK, tons of help!) from Dirk, we've now accomplished the objective.

The following changes will remove these two blocks and the additional column they reside in from your pages. They will bring back the "story options" functionality by displaying the same icons that are used on the "intro text only" views, but you will lose the "What's Related" block. To me, that's not a big deal. Here's how to do it...

  1. In article.php, find this line:
PHP Formatted Code
$story_template->set_var('site_url', $_CONF['site_url']);
Insert a /* in front of it, to start a comment block. A few rows further down, find this line:
PHP Formatted Code
.COM_endBlock());
Insert a */ at the end to end the comment block. This change removes the two blocks entirely. In article.thtml (inside the article folder in your theme folder), add a "<!--" comment marker in front of the first <td> tag, and a "-->" end comment marker at the very end of the file. This removes the spacer column and the column reserved for the blocks we're removing. There's still a dangling </td> to be found, as it's not located in article.thtml. Instead, you'll find it in footer.thtml, as the second line of the file (just below the comment). Add comment tags (<!--, -->Wink around the </td> tag to disable it. The last step is to get the email and print icons back in the story, where they originally appeared. I thought this would be the hardest step, but it's actually trivial. Open lib-common.php, and move to the COM_article() function (line 307 in my modified lib-common). Within COM_article(), find the "if ( $index == 'n' ) section, which will consist of only two lines. We need to add two more lines before the closign } tag, and we're going to steal them from the "index == 'y'" section. The two lines start as follows (trimmed here for display purposes):
PHP Formatted Code
$article->set_var( 'email_icon', '<a href="' .....
$article->set_var( 'print_icon', '<a href="' ....
Copy both of these lines (the whole lines, of course), and paste them just above the closing } tag in the "index == 'n'" section.Save all your changes, and then load a full-text article and admire your handiwork!

Thanks again to Dirk for 99.5% of the effort on this one!

-rob.


Status: offline

lifesize_ben

Forum User
Newbie
Registered: 26/03/05
Posts: 3
Does anyone know how to do this in GL 1.3.11? I was able to figure out how to get rid of the what's related and story options block, but can't figure out how to turn on the email_icon and print_icon (supposedly in lib-common.php). Where do I find the code for this?

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
The COM_article function mentioned above has been renamed STORY_renderArticle and moved to system/lib-story.php

bye, Dirk

Status: offline

lifesize_ben

Forum User
Newbie
Registered: 26/03/05
Posts: 3
Thanks much, Dirk. Found what I needed. I thought I'd post some more explicit instructions, since it's a bit different from the ones in the version listed above:

in system/lib-story.php, find the STORY_renderArticle function, and go to the section that starts
PHP Formatted Code

if( $index == 'n' )
{
    $article->set_var( 'story_title', stripslashes( $A['title'] ));
    if( empty( $A['bodytext'] ))
    {

 


In GL 1.3.11, there isn't an if( $index == 'y' ), it's just an [else] statement, so to enable the print, email (and pdf, if enabled) icons, you need to scroll down and find the series of if/else statements that starts with
PHP Formatted Code

if( $_CONF['hideemailicon'] == 1 )
{
    $article->set_var( 'email_icon', '' );
}

 


You'll need to copy the entire set of three if/else statements (one for print, one for email, one for pdf), all the way down to the last ending bracket. The last bit of code looks like this:
PHP Formatted Code

$article->set_var( 'lang_pdf_story_alt', $LANG01[111] );
}
else
{
    $article->set_var( 'pdf_icon', '' );
}

 


After you've copied that whole bit of code, go back up to the ( $index == 'n' ) section, and find the "else" part of the if( empty( $A['bodytext'] )) section. Paste the code into the "else" section, under what's already there:
PHP Formatted Code

else
{
    $bodytext = stripslashes( $A['bodytext'] );
    $bodytext = PLG_replacetags($bodytext);   // Replace any plugin autolink tags
    $article->set_var( 'story_introtext', $introtext . '<br><br>'
                       . $bodytext );
    $article->set_var( 'story_text_no_br', $introtext . $bodytext );
PASTE IT IN RIGHT HERE!
}

 


In future versions of Geeklog, I'm not sure it would be such a bad thing to have the print and email icons in article view, even with the what's related/story options block. My two cents.

Status: offline

inquest750

Forum User
Regular Poster
Registered: 04/03/05
Posts: 72
Quote by lifesize_ben: Thanks much, Dirk. Found what I needed. I thought I'd post some more explicit instructions, since it's a bit different from the ones in the version listed above:

in system/lib-story.php, find the STORY_renderArticle function, and go to the section that starts
PHP Formatted Code

if( $index == 'n' )
{
    $article->set_var( 'story_title', stripslashes( $A['title'] ));
    if( empty( $A['bodytext'] ))
    {


 


In GL 1.3.11, there isn't an if( $index == 'y' ), it's just an [else] statement, so to enable the print, email (and pdf, if enabled) icons, you need to scroll down and find the series of if/else statements that starts with
PHP Formatted Code

if( $_CONF['hideemailicon'] == 1 )
{
    $article->set_var( 'email_icon', '' );
}


 


You'll need to copy the entire set of three if/else statements (one for print, one for email, one for pdf), all the way down to the last ending bracket. The last bit of code looks like this:
PHP Formatted Code

$article->set_var( 'lang_pdf_story_alt', $LANG01[111] );
}
else
{
    $article->set_var( 'pdf_icon', '' );
}


 


After you've copied that whole bit of code, go back up to the ( $index == 'n' ) section, and find the "else" part of the if( empty( $A['bodytext'] )) section. Paste the code into the "else" section, under what's already there:
PHP Formatted Code

else
{
    $bodytext = stripslashes( $A['bodytext'] );
    $bodytext = PLG_replacetags($bodytext);   // Replace any plugin autolink tags
    $article->set_var( 'story_introtext', $introtext . '<br><br>'
                       . $bodytext );
    $article->set_var( 'story_text_no_br', $introtext . $bodytext );
PASTE IT IN RIGHT HERE!
}


 


In future versions of Geeklog, I'm not sure it would be such a bad thing to have the print and email icons in article view, even with the what's related/story options block. My two cents.



I just don't understand this, can someone help me?

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
Quote by inquest750: I just don't understand this, can someone help me?

I'm too lazy to digg through all that code now, but to solve the original problem (note the date of that post), you could simply edit the template file (article/article.thtml) and move the What's Related and Story Options blocks out of the way. In the Professional theme, they are below the story text, for example.

bye, Dirk

All times are EDT. The time is now 08:56 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content