forum.coppermine-gallery.net

Support => cpg1.4 plugins => cpg1.4.x Support => Older/other versions => cpg1.4 plugin contributions => Topic started by: Paver on January 24, 2006, 05:40:37 pm

Title: Final_Extract - Removing blocks & items like menu buttons
Post by: Paver on January 24, 2006, 05:40:37 pm
donnoman posted a handy plugin in this thread: http://forum.coppermine-gallery.net/index.php?topic=25197.0 (http://forum.coppermine-gallery.net/index.php?topic=25197.0).

The final_extract plugin removes core blocks from the final HTML produced by Coppermine, just before it is displayed to the user on the web page.  This is probably the best way to remove things like menu buttons and other core items like links & buttons throughout the various pages Coppermine produces.

This thread will serve as a central place to find this plugin and for further development.

Version 1.0 removes the 'login' and 'home' buttons on the SYS_MENU.  If you want to remove others with this version, you need to add the blocks manually to codebase.php using the 'login' and 'home' lines as examples.

If no one else does so, I plan to put together a config panel for this plugin so you can choose other blocks without modifying plugin code.  donnoman and other devs are welcome to modify this post & thread as desired.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: zac on January 28, 2006, 07:31:33 am
Hi... not sure if I am in the right place but I want to remove the menu buttons.  I tried this plugin but dont really know what i am doing.  I have used coppermine for a couple years but just got 1.4.3 last night.  Anyways.. i ftp the plugin to the folder... i turned it on in admin.. now what?  I basically want to remove all of those links.  How does this work?

*edit* nevermind.. i just commented the whole thing out in my template.html
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Paver on January 28, 2006, 08:12:55 am
If you want to remove the whole menus, then commenting them out in template.html is the best way.  I don't use the SUB_MENU myself so I merely removed it.  (I created a custom SYS_MENU with all the buttons I need.)

This plugin currently removes the Home and Login buttons.  There's no configuration panel.  If you want to remove any others, you have to modify codebase.php of the plugin.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: zac on January 28, 2006, 08:39:40 am
thanks Paver!  The menu is gone in Firefox but still there in IE !?  weird  ???

check it out ... http://www.folkphotography.com/shop/
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Paver on January 28, 2006, 09:05:43 am
Yeah, this is a common issue.  What's happening is that you have nested comments.  You commented out the SYS_MENU in template.html, but the SYS_MENU tag is replaced with HTML which includes its own comments.  Firefox can understand the nested comments (which takes extra work keeping track of all the begin & end comment markers), but IE merely closes all comments when it comes to an end comment marker, no matter how many begin comment markers came before (due to nesting).

I suspected this might happen, so that's why I mentioned removing the things you don't want from template.html.  I thought you had it working so didn't explicitly mention the comment issue.

Nice-looking website!  I don't know if there's any easy way for you to make your theme generic and submit it as a theme contribution.  If you feel like it, it would be a nice way to share your theme.  If you don't think you have time, you could contribute what you have and maybe someone will volunteer to make it generic using category placeholders or the like, probably putting the menus back in some coherent way.  If you would like to keep the theme to yourself, that's perfectly understandable as well.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: zac on January 28, 2006, 09:32:29 pm
ok .. I will just start tweaking the theme.. I am starting to understand this new version a little bit.. many thanks.  Glad you like my site :) it still has a ways to go as when I am done modifying it there will be little remaining.  I am going for very minimalist even though it is hard to give up a lot of the functionality of cpm.   I will eventually try to share my theme hack as I never would have been able to do it without all of the awesome sharing and teaching that goes on in this community and at Pixelpost (where I got the Sugar template that my site is based on). Right now I am trying to install Dennis's paypal hack.. if my head doesnt explode during that I will strip my theme generic and try to figure out a layout for all of the links that come stock.

Cheers !

Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: rie on January 29, 2006, 01:36:12 am
Thanks for this..

I had something I wanted to remove but was having troubles figuring out where. 

I altered it slightly for my use. 
I made it:
Code: [Select]

 if (!USER_ID) {  final_extract_block ($html,'favpics');}


So that some of the menu items are unavailable if you are not logged in.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: zac on January 29, 2006, 02:08:02 am
not sure what you are trying to remove rie...I fixed by copying from the sample theme to my theme and commenting out each link that I did not want..

I copied from sample starting at line 113

Code: [Select]
// Creates buttons from a template using an array of tokens

// this function is used in this file it needs to be declared before being called.


and ending with this at line 363

Code: [Select]
<!-- END documentation -->

                        </tr>

                </table>

                </div>



EOT;


oops  ???  dont do that.  when i logged out of admin I got a whole lot of errors *yikes*
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Paver on January 29, 2006, 02:12:55 am
I think rie's point was that it was easier to add one line to the plugin than to find the block in the theme to remove.  There are a lot of blocks in the theme that you can remove there, but this plugin is dirt-simple to add one line and remove it in the final HTML.  It is true that it's less efficient to create the code, then remove it at the end before it is displayed, but the performance hit must be negligible except in very few extreme-traffic cases, I would think.

rie's addition suggests an addition to this plugin to allow configuration of anonymous vs. logged-in removal of blocks.  I can easily add that to my working version and put it into the next release.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: rie on January 29, 2006, 02:14:50 am
Yes what Paver said.

I started with the rainy_day theme and was going to tweak that.
Once I saw this plugin, I figured it would be easier to do it here.    I was guessing that this should cover all themes.

Roger
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: zac on January 29, 2006, 02:15:43 am
hmmm i need dirt simple .  i will take another look at this plugin.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Paver on January 29, 2006, 02:17:03 am
@rie: Yes, that's a good point - this covers all themes.  There's also a master template plugin which can be used for similar "all themes" theme modifications.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: zac on January 29, 2006, 02:34:16 am
ah finally i got it..  great plugin Paver. and your addition too rie... (catching on a little late)Thanks !  I added this to get rid of everything.. :

Code: [Select]
//repeat the next line for each block you would like removed
      final_extract_block($html, 'my_gallery');
  final_extract_block($html, 'my_profile');
  final_extract_block($html, 'upload_pic');
  final_extract_block($html, 'lastup');
      final_extract_block($html, 'toprated');
      final_extract_block($html, 'favpics');
      final_extract_block($html, 'home');
  final_extract_block($html, 'search');
  final_extract_block($html, 'login');
  final_extract_block($html, 'lastcom');
  final_extract_block($html, 'album_list');
  final_extract_block($html, 'topn');

return $html;
}
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Kugelblitz on January 31, 2006, 07:13:29 am
Cool Plugin, but I still can not hide the Buttons

home, lastcom, topn and favpics

Any Suggestions?

Thanks for help



here is my codebase.php

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.1
  $Source: /cvsroot/cpg-contrib/master_template/codebase.php,v $
  $Revision: 1.3 $
  $Author: donnoman $
  $Date: 2005/12/08 05:46:49 $
**********************************************/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

$thisplugin->add_filter('page_html','final_extract_page_html');

function 
final_extract_block(&$template$block_name$subst='')
{
        
$pattern "#(<!-- BEGIN $block_name -->)(.*?)(<!-- END $block_name -->)#s";
        if ( 
preg_match($pattern$template$matches)){
            
$template str_replace($matches[1].$matches[2].$matches[3], $subst$template);
            return 
$matches[2];
        }
}

function 
final_extract_page_html($html)
{   
    
//repeat the next line for each block you would like removed
 
final_extract_block($html'home');
        
final_extract_block($html'my_gallery');
final_extract_block($html'allow_memberlist');
final_extract_block($html'my_profile');
final_extract_block($html'enter_admin_mode');
final_extract_block($html'leave_admin_mode');
final_extract_block($html'register');
 
//     final_extract_block($html, 'faq');
 // final_extract_block($html, 'login');
 // final_extract_block($html, 'logout');
 // final_extract_block($html, 'custom_link');
final_extract_block($html'album_list');
final_extract_block($html'lastup');
final_extract_block($html'lastcom');
final_extract_block($html'topn');
final_extract_block($html'toprated');
final_extract_block($html'favpics');
final_extract_block($html'search');

return $html;
}

?>
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Paver on January 31, 2006, 08:17:15 am
What theme are you using?  If you customized your theme or are using a theme where the "My Favorites" link is not properly bracketed by the 'favpics' tags, then this plugin cannot find that link.  You can also look at "View Source" for your webpage to see if the links are properly bracketed.  If you look in the sample/theme.php, you'll see how the system menu buttons are supposed to be tagged.

If those links are not properly bracketed, you can either bracket them properly and use this plugin, or just remove those links manually.  It's safer to use the plugin since other parts of Coppermine may look for those links, but if they aren't bracketed properly now and Coppermine hasn't complained, maybe you are safe.  Then again, some condition may have Coppermine looking for them.  I just checked and 'favpics' is not used by Coppermine anywhere so that one is safe to manually delete.  But I guess it's still better to use the plugin to remove it to make it easier to put it back if you want or for future versions (although that's thinking a bit ahead).
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Kugelblitz on February 02, 2006, 06:59:09 am
I am customizing a theme with images as Menu Buttons.

I solved my "Remove Button" Problem with reading this Thread
http://forum.coppermine-gallery.net/index.php?topic=25197.0 (http://forum.coppermine-gallery.net/index.php?topic=25197.0)

Would be cool to have an option "show x Button          [ ]Yes [X]No" in the next release.

I sometimes had the problem that I could not login into my page when the Plugin was activated. Had to change the "execute" Right for the Plugin Folder by using a FTP Programm.
Didn't know why. No Error Message appeared.
It works for now.

Thanks for the Plugin and Your Help  ;)
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Joachim Müller on February 02, 2006, 09:32:34 am
all PHP files need read/execute permissions to run, that's expected behaviour.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: markp17 on February 06, 2006, 11:22:11 pm
ok, got it working, however there was no link to the plugin manager, so had to link directly to it from browser.. strange but could not find the link.

thanks anyway it works
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Nibbler on February 06, 2006, 11:23:34 pm
The link is on the config page, 'Manage plugins'.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Joachim Müller on February 07, 2006, 07:49:29 am
see http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#plugin_manager
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Cymon Sez on February 21, 2006, 12:40:36 am
When the plug in is installed it will not let me modify the codebase.php file is this normal?
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Joachim Müller on February 21, 2006, 04:28:55 am
what do you mean? You can't edit the source code of the file directly on the server - you download it, modify it and upload it. Who should keep you from that?
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Nibbler on February 21, 2006, 12:25:01 pm
As codebase.php was uploaded via HTTP and then extracted on the server it may not be owned by you (depends on server setup). If you need to edit the code then I would suggest uninstalling it and then uploading the plugin's folder into Copermine's plugins folder via FTP. You can then install it without needing to do the HTTP upload step.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: bonso1 on February 22, 2006, 12:36:05 am
hello dear board developers !

it seems im much to stupid to understand how to use the suggested "master_template"
which i have downloaded and installed, and activated.

OK all i can see after i have done that is the big coppermine banner at the bottom of all my pages.

and now .... what ?? what could this plugin do now for me ?
how to remove buttons or links from
SYS_MENU or SUB_MENU ?? without to copy the code from templates/sample/ into my amost empty themes/mytheme

i have read the thread http://forum.coppermine-gallery.net/index.php?topic=26897.0 allready often,
but sorry ... what could this plugin do for a php-html newbie ???

let me say ... i love your programm a lot, but since cpg14x everything for me becomes much more complictated
regarding to modify something on the design. (i can imagine ... for guys which are very firm with php everything becomes better)
and it not your fault that im a green newbie.
pls. dont understand me wrong ...for programmes like you ... most of all to modify is very easy, but belive me
i spent much much hours to search the forums to get a hint how to do theses or that, but it seems ...
im realy to stupid, and i have to learn still a lot regarding php.

so im afraid ... to must copy from themes/sample   the necessary code for my SYS_MENU or SUB_MENU
and must // it what i dont like to showed up , and i stupid guy thaught ... with this master_template_plugin whic i have installed
shows up kinda console or form, where its easy to add, hide, point to custom URLS within SYS_MENU or SUB_MENU , dosnt matter
 which template i use.

Whenever cpg gets such a feature .... a newbie like me would become crazy (because of joy) about this feature.

anyway ... cpg is my absolute fav. from all online picture gallerie programms  !!!!

but perhaps ... anyone can explain in basic words how this plugins works  ::)

thank you very much, i realy appreciate what you guys offer for a great proggy and thats for FREE !!!!

regrads ... manfred














Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: SpeakToMeNow on February 27, 2006, 10:44:56 am
donnoman posted a handy plugin in this thread: http://forum.coppermine-gallery.net/index.php?topic=25197.0 (http://forum.coppermine-gallery.net/index.php?topic=25197.0).

I have just installed and started playing with coppermine today and can i just say THANK YOU for this plug in - it is simply brilliant and I would never have mangaged to have come up with a solution like this.

Thanks to people who develop things like this - much good karma upon you. ;D
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: N2GetherNow on June 12, 2006, 10:38:26 am
Where can i find all of abbreviations that Cappermine gallery use for buttons?
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: François Keller on July 19, 2006, 09:41:17 pm
Hi,

I have modified donoman's final_extract plugin so you can chose the blocks you will remouve according to user group
in attachement the zip file from the modified plugin
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Xath on July 27, 2006, 02:22:42 pm
I'm not quite understanding how to do all of this.. Specially since reading another thread.

Anyway, in the codebase.php I'd like to remove the links top rated and most viewed.

What I can't figure out is HOW to add it in the codebase.php

Like this?
Code: [Select]
final_extract_block($html, 'top rated');
final_extract_block($html, 'most viewed');

Or this?
Code: [Select]
final_extract_block($html, 'top_rated');
final_extract_block($html, 'most_viewed');


Oups edited an error.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Paver on July 27, 2006, 02:44:30 pm
You need to use the "BLOCK_ID" to remove those links.  For a theme based on the new 1.4 theme system, you'll find something like this in themes/yourtheme/theme.php:
Code: [Select]
    // HTML template for template sub_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');

As the comment says, the BLOCK_ID is the 4th string.  So for "top rated", the BLOCK_ID is 'toprated' and for "most viewed", it's 'topn'.

However, if you are using a theme that doesn't use this new "addbutton" method of adding the links, "top rated" and "most viewed" may not be marked properly.  Looking at the themes that ship with 1.4 like hardwired and mac_osx, they do not mark these links properly.  I mentioned this earlier in this thread.

Hardwired has this for "top rated":
Code: [Select]
                                        <td><img name="buttonright1" src="themes/hardwired/images/buttonright1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft1" src="themes/hardwired/images/buttonleft1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/hardwired/images/buttoncenter.gif);">
                                                <a href="{TOPRATED_TGT}" title="{TOPRATED_LNK}">{TOPRATED_LNK}</a>
                                        </td>

It should instead have this (to be properly marked):
Code: [Select]
<!-- BEGIN toprated -->
                                        <td><img name="buttonright1" src="themes/hardwired/images/buttonright1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft1" src="themes/hardwired/images/buttonleft1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/hardwired/images/buttoncenter.gif);">
                                                <a href="{TOPRATED_TGT}" title="{TOPRATED_LNK}">{TOPRATED_LNK}</a>
                                        </td>
<!-- END toprated -->

So the final_extract plugin cannot remove the "top rated" link from the hardwired theme unless you add the two comments I showed above.

As I said previously in this thread, you should either remove the links manually in your theme or add the comments in and use the final_extract plugin.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Xath on July 27, 2006, 02:51:27 pm
You need to use the "BLOCK_ID" to remove those links.  For a theme based on the new 1.4 theme system, you'll find something like this in themes/yourtheme/theme.php:
Code: [Select]
  // HTML template for template sub_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
  addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
  addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');

That is why it's so confusing, this theme doesn't have that.
I've looked over serveral threads to try to understand it.
Like this one http://forum.coppermine-gallery.net/index.php?topic=26897.0 (http://forum.coppermine-gallery.net/index.php?topic=26897.0), and it makes no sense to me..No matter how hard I try to understand and how many times I read it. (Which is about 12 by now.)

This theme has HTML links.
But in the theme.html is nothing either.

This is the only code I can find in the theme.php
Code: [Select]
    $param = array(
        '{ALB_LIST_TGT}' => "index.php$cat_l",
        '{ALB_LIST_TITLE}' => $lang_main_menu['alb_list_title'],
        '{ALB_LIST_LNK}' => $lang_main_menu['alb_list_lnk'],
        '{CUSTOM_LNK_TGT}' => $CONFIG['custom_lnk_url'],
        '{CUSTOM_LNK_TITLE}' => $CONFIG['custom_lnk_name'],
        '{CUSTOM_LNK_LNK}' => $CONFIG['custom_lnk_name'],
        '{LASTUP_TGT}' => "thumbnails.php?album=lastup$cat_l2",
        '{LASTUP_TITLE}' => $lang_main_menu['lastup_title'],
        '{LASTUP_LNK}' => $lang_main_menu['lastup_lnk'],
        '{LASTCOM_TGT}' => "thumbnails.php?album=lastcom$cat_l2",
        '{LASTCOM_TITLE}' => $lang_main_menu['lastcom_title'],
        '{LASTCOM_LNK}' => $lang_main_menu['lastcom_lnk'],
        '{TOPN_TGT}' => "thumbnails.php?album=topn$cat_l2",
        '{TOPN_TITLE}' => $lang_main_menu['topn_title'],
        '{TOPN_LNK}' => $lang_main_menu['topn_lnk'],
        '{TOPRATED_TGT}' => "thumbnails.php?album=toprated$cat_l2",
        '{TOPRATED_TITLE}' => $lang_main_menu['toprated_title'],
        '{TOPRATED_LNK}' => $lang_main_menu['toprated_lnk'],
        '{FAV_TGT}' => "thumbnails.php?album=favpics",
        '{FAV_TITLE}' => $lang_main_menu['fav_title'],
        '{FAV_LNK}' => $lang_main_menu['fav_lnk'],
        '{SEARCH_TGT}' => "search.php",
        '{SEARCH_TITLE}' => $lang_main_menu['search_title'],
        '{SEARCH_LNK}' => $lang_main_menu['search_lnk'],
        );
    $sub_menu = template_eval($template_sub_menu, $param);
  }

I tried commenting it out with //.
But then it left this in the menu instead:
{FAV_LNK}

Edit: I'm using the Blix theme.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Sami on July 27, 2006, 02:59:30 pm
if you don't have the code on your theme.php then copy it from themes/sample/theme.php to your theme.php
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Xath on July 27, 2006, 03:25:10 pm
if you don't have the code on your theme.php then copy it from themes/sample/theme.php to your theme.php

Ah..yes..but this creates more problems, no errors, but the top links here http://www.leij.net/viparea/gallery/ (http://www.leij.net/viparea/gallery/)
should be looking like the ones here http://www.leij.net/viparea/ (http://www.leij.net/viparea/)

Now that I added the code that I copied from themes/sample/theme.php it makes it only text.

I'm not sure weather or not to continue this thread here or make a new topic in the themes support.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Paver on July 27, 2006, 03:41:39 pm
If your themes/yourtheme/theme.php doesn't have the menu customizations, then it is using the default Coppermine one which uses the addbutton method, which means that 'topn' and 'toprated' are marked correctly.

So . . . use the final_extract plugin with the BLOCK_IDs 'topn' and 'toprated' and you should be all set.

There is no need to copy the code from the sample theme unless you want to customize the menus manually.  The final_extract plugin eliminates the need for manual customizations in theme.php.  Yes, the plugin does require manually changing its codebase.php, but that's a separate issue (and will hopefully be removed in the future with a nice web panel configuration).
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Xath on July 27, 2006, 05:46:37 pm
There is no need to copy the code from the sample theme unless you want to customize the menus manually.  The final_extract plugin eliminates the need for manual customizations in theme.php.  Yes, the plugin does require manually changing its codebase.php, but that's a separate issue (and will hopefully be removed in the future with a nice web panel configuration).

How do I remove them manually? It was so much easier in the early versions.
I've used the search but it all comes back to the final_extract.

Maybe someone who can help, can PM me so I stop cluttering the thread. :o
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Paver on July 27, 2006, 05:57:22 pm
You're not cluttering the thread.  Support is kept on the public boards so others can learn from your questions.

If you only want to remove the "most viewed" and "top rated" links, I would still recommend the final_extract plugin.

Modify the plugins/final_extract/codebase.php so that the main function looks like this:
Code: [Select]
function final_extract_page_html($html)
{   
    //repeat the next line for each block you would like removed
    final_extract_block($html, 'topn');
    final_extract_block($html, 'toprated');
return $html;
}

Then make sure the final_extract plugin is installed (on the plugin manager page).

I just tried this with the Blix theme on my test gallery and it does what you want: remove the "most viewed" and "top rated" links.

If you want to do something different than just remove the links, then learning the theme system is required.  But for just removing blocks, the final_extract plugin is the simplest way to do so.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Xath on July 27, 2006, 06:02:15 pm
You're not cluttering the thread.  Support is kept on the public boards so others can learn from your questions.

If you only want to remove the "most viewed" and "top rated" links, I would still recommend the final_extract plugin.

Modify the plugins/final_extract/codebase.php so that the main function looks like this:
Code: [Select]
function final_extract_page_html($html)
{   
    //repeat the next line for each block you would like removed
    final_extract_block($html, 'topn');
    final_extract_block($html, 'toprated');
return $html;
}

Then make sure the final_extract plugin is installed (on the plugin manager page).

I just tried this with the Blix theme on my test gallery and it does what you want: remove the "most viewed" and "top rated" links.

If you want to do something different than just remove the links, then learning the theme system is required.  But for just removing blocks, the final_extract plugin is the simplest way to do so.


Works like a charm! Thanks alot for all the help! :D
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: warhonowicz on September 13, 2006, 12:41:29 pm
I am playing around with this as well. I am using a copy of the sample theme at the moment while I am learning how to do this in Copperminer 1.4.9 after upgrading from 1.3.5.

My theme.php has this

Code: [Select]
// HTML template for template sys_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MEMBERLIST_LNK}','{MEMBERLIST_TITLE}','{MEMBERLIST_TGT}','allow_memberlist',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MY_PROF_LNK}','{MY_PROF_TITLE}','{MY_PROF_TGT}','my_profile',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{ADM_MODE_LNK}','{ADM_MODE_TITLE}','{ADM_MODE_TGT}','enter_admin_mode',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{USR_MODE_LNK}','{USR_MODE_TITLE}','{USR_MODE_TGT}','leave_admin_mode',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{UPL_PIC_LNK}','{UPL_PIC_TITLE}','{UPL_PIC_TGT}','upload_pic',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{REGISTER_LNK}','{REGISTER_TITLE}','{REGISTER_TGT}','register',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{FAQ_LNK}','{FAQ_TITLE}','{FAQ_TGT}','faq',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');
    addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');
    // Login and Logout don't have a spacer as only one is shown, and either would be the last option.

and the plugin works a treat to remove a number of these buttons. However, I would also like to remove the My Profile button.

Am I right in assuming that the way to do that is to change this section in my theme.php

Code: [Select]
// HTML template for gallery admin menu
$template_gallery_admin_menu = <<<EOT

                <div align="center">
                <table cellpadding="0" cellspacing="1">
                        <tr>
<!-- BEGIN admin_approval -->
                                <td class="admin_menu" id="admin_menu_anim"><a href="editpics.php?mode=upload_approval" title="{UPL_APP_TITLE}">{UPL_APP_LNK}</a></td>
<!-- END admin_approval -->
                                <td class="admin_menu"><a href="admin.php" title="{ADMIN_TITLE}">{ADMIN_LNK}</a></td>
                                <td class="admin_menu"><a href="catmgr.php" title="{CATEGORIES_TITLE}">{CATEGORIES_LNK}</a></td>
                                <td class="admin_menu"><a href="albmgr.php{CATL}" title="{ALBUMS_TITLE}">{ALBUMS_LNK}</a></td>
                                <td class="admin_menu"><a href="groupmgr.php" title="{GROUPS_TITLE}">{GROUPS_LNK}</a></td>
                                <td class="admin_menu"><a href="usermgr.php" title="{USERS_TITLE}">{USERS_LNK}</a></td>
                                <td class="admin_menu"><a href="banning.php" title="{BAN_TITLE}">{BAN_LNK}</a></td>
                                <td class="admin_menu"><a href="reviewcom.php" title="{COMMENTS_TITLE}">{COMMENTS_LNK}</a></td>
<!-- BEGIN log_ecards -->
                                <td class="admin_menu"><a href="db_ecard.php" title="{DB_ECARD_TITLE}">{DB_ECARD_LNK}</a></td>
<!-- END log_ecards -->
                                <td class="admin_menu"><a href="picmgr.php" title="{PICTURES_TITLE}">{PICTURES_LNK}</a></td>
                                <td class="admin_menu"><a href="searchnew.php" title="{SEARCHNEW_TITLE}">{SEARCHNEW_LNK}</a></td>
                                <td class="admin_menu"><a href="util.php" title="{UTIL_TITLE}">{UTIL_LNK}</a></td>
<!--                                <td class="admin_menu"><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}">{MY_PROF_LNK}</a></td>-->
<!-- BEGIN documentation -->
                                <td class="admin_menu"><a href="{DOCUMENTATION_HREF}" title="{DOCUMENTATION_TITLE}" target="cpg_documentation">{DOCUMENTATION_LNK}</a></td>
<!-- END documentation -->
                        </tr>
                </table>
                </div>

EOT;

// HTML template for user admin menu
$template_user_admin_menu = <<<EOT

                <div align="center">
                <table cellpadding="0" cellspacing="1">
                        <tr>
                                <td class="admin_menu"><a href="albmgr.php" title="{ALBMGR_TITLE}">{ALBMGR_LNK}</a></td>
                                <td class="admin_menu"><a href="modifyalb.php" title="{MODIFYALB_TITLE}">{MODIFYALB_LNK}</a></td>
<!--                                <td class="admin_menu"><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}">{MY_PROF_LNK}</a></td>-->
                                <td class="admin_menu"><a href="picmgr.php" title="{PICTURES_TITLE}">{PICTURES_LNK}</a></td>
                        </tr>
                </table>
                </div>

EOT;

and comment the My Profile link out as I have done it? It does work, but I am just unsure whether the plugin would have been able to handle it as well.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Sami on September 13, 2006, 01:30:27 pm
New version of this plugin has an option to remove that
http://forum.coppermine-gallery.net/index.php?topic=34637.0
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: warhonowicz on September 13, 2006, 04:29:14 pm
New version of this plugin has an option to remove that
http://forum.coppermine-gallery.net/index.php?topic=34637.0

well, after installing the new version ...

it does not remove the logout button and it does not on my screen have an option to remove the My Profile button.

I am using basically the sample theme with very few modifications
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Sami on September 13, 2006, 04:43:02 pm
- oops ! sorry I should confess that I don't read your first post completely
- You need to use this code instead of yours
Code: [Select]
// HTML template for gallery admin menu
$template_gallery_admin_menu = <<<EOT

                <div align="center">
                <table cellpadding="0" cellspacing="1">
                        <tr>
<!-- BEGIN admin_approval -->
                                <td class="admin_menu" id="admin_menu_anim"><a href="editpics.php?mode=upload_approval" title="{UPL_APP_TITLE}">{UPL_APP_LNK}</a></td>
<!-- END admin_approval -->
                                <td class="admin_menu"><a href="admin.php" title="{ADMIN_TITLE}">{ADMIN_LNK}</a></td>
                                <td class="admin_menu"><a href="catmgr.php" title="{CATEGORIES_TITLE}">{CATEGORIES_LNK}</a></td>
                                <td class="admin_menu"><a href="albmgr.php{CATL}" title="{ALBUMS_TITLE}">{ALBUMS_LNK}</a></td>
                                <td class="admin_menu"><a href="groupmgr.php" title="{GROUPS_TITLE}">{GROUPS_LNK}</a></td>
                                <td class="admin_menu"><a href="usermgr.php" title="{USERS_TITLE}">{USERS_LNK}</a></td>
                                <td class="admin_menu"><a href="banning.php" title="{BAN_TITLE}">{BAN_LNK}</a></td>
                                <td class="admin_menu"><a href="reviewcom.php" title="{COMMENTS_TITLE}">{COMMENTS_LNK}</a></td>
<!-- BEGIN log_ecards -->
                                <td class="admin_menu"><a href="db_ecard.php" title="{DB_ECARD_TITLE}">{DB_ECARD_LNK}</a></td>
<!-- END log_ecards -->
                                <td class="admin_menu"><a href="picmgr.php" title="{PICTURES_TITLE}">{PICTURES_LNK}</a></td>
                                <td class="admin_menu"><a href="searchnew.php" title="{SEARCHNEW_TITLE}">{SEARCHNEW_LNK}</a></td>
                                <td class="admin_menu"><a href="util.php" title="{UTIL_TITLE}">{UTIL_LNK}</a></td>
<!-- BEGIN profile -->
                              <td class="admin_menu"><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}">{MY_PROF_LNK}</a></td>
<!-- End profile -->
<!-- BEGIN documentation -->
                                <td class="admin_menu"><a href="{DOCUMENTATION_HREF}" title="{DOCUMENTATION_TITLE}" target="cpg_documentation">{DOCUMENTATION_LNK}</a></td>
<!-- END documentation -->
                        </tr>
                </table>
                </div>

EOT;

// HTML template for user admin menu
$template_user_admin_menu = <<<EOT

                <div align="center">
                <table cellpadding="0" cellspacing="1">
                        <tr>
                                <td class="admin_menu"><a href="albmgr.php" title="{ALBMGR_TITLE}">{ALBMGR_LNK}</a></td>
                                <td class="admin_menu"><a href="modifyalb.php" title="{MODIFYALB_TITLE}">{MODIFYALB_LNK}</a></td>
<!--                                <td class="admin_menu"><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}">{MY_PROF_LNK}</a></td>-->
                                <td class="admin_menu"><a href="picmgr.php" title="{PICTURES_TITLE}">{PICTURES_LNK}</a></td>
                        </tr>
                </table>
                </div>

EOT;

and then add this to codebase.php
Code: [Select]
final_extract_block($html, 'profile');
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Aeronautic on October 03, 2006, 10:44:10 pm
Somehow I must have messed this up, but I can't figure out how.

Running the 2nd version of the plugin in CPG 1.4.9 - Hardwired

http://www.aeronauticpictures.com/royalty-free-stock-footage/

When I ran it with the default code it worked as expected. Then I removed the block of the home page part for guests and added the other blocks I wanted out for guests.

FYI: I only have admin and guests - nobody else will register and use the gallery.

My goal is for guests to see home, custom, search and album.

Any ideas where I went wrong? It is showing blocks to guests instead of hiding them. Yes, the plugin is enabled and installed. I tried uninstalling, unenabling and back again too.

Is this the "<!-- BEGIN block -->  <!-- END block -->" issue from theme.php?

Edit: It was this tag block issue. Changes made to hardwired/theme.php to add block tags. Now working at link above.

Code: [Select]
function final_extract_page_html($html)
{   
$user_group=USER_ID;
//define the user group
switch ($user_group){
case 1://admin show all menus
return $html;
break;
case 2://registred
//repeat the next line for each block you would like removed
final_extract_block($html, 'login');
    final_extract_block($html, 'home');
    return $html;
break;
case 3://guest
//repeat the next line for each block you would like removed
    final_extract_block($html, 'lastup');
    final_extract_block($html, 'toprated');
    final_extract_block($html, 'favpics');
    final_extract_block($html, 'lastcom');
    final_extract_block($html, 'topn');
    return $html;
default://all othe cases
    //repeat the next line for each block you would like removed
    final_extract_block($html, 'lastup');
    final_extract_block($html, 'toprated');
    final_extract_block($html, 'favpics');
    final_extract_block($html, 'lastcom');
    final_extract_block($html, 'topn');
return $html;
}

Thank you for the plugin and the help!

Edit: Found this post: http://forum.coppermine-gallery.net/index.php?topic=26893.msg160551#msg160551

Looks like it could be the call out in Hardwired. Will test and update.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Sami on October 04, 2006, 05:55:59 am
Running the 2nd version of the plugin in CPG 1.4.9 - Hardwired

My goal is for guests to see home, custom, search and album.

BTW you can use Final extarct 2.3 with admin panel and group selection here:
http://forum.coppermine-gallery.net/index.php?topic=36605.0
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Aeronautic on October 04, 2006, 08:36:44 pm
Thanks Sami!

Will give that a try too.

Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: lily64 on November 14, 2006, 05:41:22 am
I am very distressed because I just used this Final Extract and as soon as I uploaded it and loaded the admin panel, the gallery ceased to function period.  I have spent countless hours getting this gallery customized for a client and don't understand why this would cause it to no longer function at all.

The gallery is here: http://www.liveedgepottery.com/cpg149/
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: lily64 on November 14, 2006, 05:53:25 am
Got it.  Went into PhpMyAdmin and deleted the Final Extract from the DB, which then freed it up.  I have no idea why this would cause this, but will not use it that's for sure unless there is a fix.

Thanks.
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: Hein Traag on November 14, 2006, 08:39:52 am
Final Extract works perfectly. Really usefull tool to clean up the look of CPG for the users and guest users.

Dutch language file attached.

Cheers!
Hein
Title: Re: Final_Extract - Removing blocks & items like menu buttons
Post by: MaPzel on February 15, 2011, 02:51:27 pm
For some reason my pluginmgr does not work with my Joomla integration. After ftp uploading 'Final Extract' I want to install it, but the pluginmgr gives the following error:

Code: [Select]
Fatal error: Cannot redeclare deldir() (previously declared in /home/vhosts/twvhengelo.com/httpdocs/fotoalbum/pluginmgr.php:239) in /home/vhosts/twvhengelo.com/httpdocs/website/plugins/system/legacy/functions.php on line 713
Is it possible to insert the code from the plugin (codebase.php) into a custom theme.php? Or should the php code be inserted in an other file? I don't know exactly where the final html display codes are generated.

I already tried to insert the next code into my theme.php after 'function theme_display_fullsize_pic()' and just before '?>
<!DOCTYPE html PUBLIC.....'

Code: [Select]
function final_extract_block(&$template, $block_name, $subst='')
{
        $pattern = "#(<!-- BEGIN $block_name -->)(.*?)(<!-- END $block_name -->)#s";
        if ( preg_match($pattern, $template, $matches)){
            $template = str_replace($matches[1].$matches[2].$matches[3], $subst, $template);
            return $matches[2];
        }
}

function final_extract_page_html($html)
{   
    //repeat the next line for each block you would like removed
  final_extract_block($html, 'login');
  final_extract_block($html, 'home');
final_extract_block($html, 'my_gallery');
final_extract_block($html, 'allow_memberlist');
final_extract_block($html, 'my_profile');
final_extract_block($html, 'enter_admin_mode');
final_extract_block($html, 'leave_admin_mode');
final_extract_block($html, 'upload_pic');
final_extract_block($html, 'register');
final_extract_block($html, 'faq');
final_extract_block($html, 'logout');
final_extract_block($html, 'upload_pic');
// final_extract_block($html, 'lastup');
//     final_extract_block($html, 'toprated');
//     final_extract_block($html, 'favpics');
// final_extract_block($html, 'search');
// final_extract_block($html, 'lastcom');
// final_extract_block($html, 'album_list');
// final_extract_block($html, 'topn');

return $html;
}

My album can be viewed here: http://www.twvhengelo.com/website/index.php?option=com_wrapper&view=wrapper&Itemid=57

Or http://www.twvhengelo.com/fotoalbum for displaying only the Coppermine installation

I'm running the Joomla 1.5.21 and Coppermine 1.4.27