ShareButtons-Talk

Summary: Talk page for ShareButtons.
Maintainer: Petko
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Search

Thanks for this recipe.
I have a peculiar case, I have some important pages that cannot be opened (too much data, equal to hundreds of pages each one), but they can be partially displayed with extract and everything works well.
I saw in sharebuttons.php the use of {$PageUrl}. If it is feasible, may I ask to add something to share the full search link (e.g. https://...?n=Cookbook.ShareButtons&action=search&q=word)? Maybe with a conditional string (if search) and a new PV (e.g. {$FullUrl}) in the php to retrieve the complete url?
Thank you. -- Frank September 05, 2019, at 03:32 PM

I've released version 20190905 which allows you to set in config.php something like:

  $RequestUrl = "$UrlScheme://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
  $FmtPV['$RequestUrl'] = '$GLOBALS["RequestUrl"]';

  $ShareButtons['DefaultShareUrl'] = '$RequestUrl';
  include_once("$FarmD/cookbook/sharebuttons.php");

The first 2 lines create a special variable {$RequestUrl} that should contain the full URL (except a #section_hash part which is browser-only). The third line sets this variable as the "shared URL" of the buttons. --Petko September 05, 2019, at 07:04 PM

Thank you very much, it works perfectly. -- Frank September 05, 2019, at 09:36 PM


Print

How don't print the sharebuttons with action=print ? Thanks

You can unload the recipe when action=print :
  if ($action != 'print') # ADD line
    include_once("$FarmD/cookbook/sharebuttons.php");

Also, hide the buttons from the "print" browser styles, in case someone prints the regular page. Add to pub/css/local.css:

  @media print {
    .resp-sharing-button__link {display: none; }
  }

Petko September 03, 2019, at 05:49 PM

FidelioEspoir : Thanks ! and one more : (:if !equal "{$Action}" "print":)(:share:) in a page script


Dimensions / bug

First I tried putting the markup in my footer, using the pmwiki-responsive skin. Since the icons were a bit large for my page and I couldn't see how to reduce them, I tried putting the markup in my sidebar instead.

There the icons occupied the full width in a vertical column. I tried to shrink them by putting the markup inside a table with width=25pct; that sort of works.

Is there a better way to control their presentation size and arrangement? -- RandyB August 29, 2019, at 09:12 PM

I've updated the recipe and the documentation. The problem with large icons in the sidebar or footer came from the fact that the recipe only injected the CSS after a (:share:) directive is encountered, but when the sidebar or footer is processed, the CSS has already been output to the browser. On my development wiki I had a (:share:) directive in both the page and the sidebar, and I didn't experience the bug at first, only when I edited another page (as I also had a forced preview while editing so the styles worked when editing the same page, but not another one). It now always injects the CSS into the page, in case someone installs the directive in a sidebar, header or footer. --Petko September 01, 2019, at 09:22 AM

Talk page for the ShareButtons recipe (users?).