Skip to main content
Topic: ManageSettings.... (Read 8170 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: ManageSettings....

Reply #15

Delete GHF.subs.php in sources/addons. Then uninstall.

Fixes:
1. Mid not main (in hooks file):
Code: [Select]
'integrate_buffer' => 'GHF_Mid|SOURCEDIR/addons/GHF.subs.php',
2. Remove the parenthesis to (in subs file):
Code: [Select]
	// Add things in header
if (!empty($modSettings['global_head'])) {
$context['html_headers'] .= $modSettings['global_head'];
}
// Add things in footer
if (!empty($modSettings['global_foot'])) {
$context['insert_after_template'] .= $modSettings['global_foot'];
}

That should work. ;)

Re: ManageSettings....

Reply #16

Hm, I will try this when it is a real modification package.  ;)

Re: ManageSettings....

Reply #17

Quote from: ahrasis – Delete GHF.subs.php in sources/addons. Then uninstall.

Fixes:
1. Mid not main (in hooks file):
Code: [Select]
'integrate_buffer' => 'GHF_Mid|SOURCEDIR/addons/GHF.subs.php',
2. Remove the parenthesis to (in subs file):
Code: [Select]
	// Add things in header
if (!empty($modSettings['global_head'])) {
$context['html_headers'] .= $modSettings['global_head'];
}
// Add things in footer
if (!empty($modSettings['global_foot'])) {
$context['insert_after_template'] .= $modSettings['global_foot'];
}

That should work. ;)


Do I keep the . before the = ?

EDIT: removed them, and it installs fine.
However, the footer is under the footer area's div, and not inside it.
The copyright does not show. (We both seemed to have missed it...LOL)

Rest appears to be fine, so at least we are 60% there. :P

Can see at: http://bke.cc.nf
The Big BKE logos are what I added to the Mid and Footer. The favicon, is what added to Head.

Re: ManageSettings....

Reply #18

I didn't see code for copyright in your modification file when I read it at the github yesterday. May be I missed it. I will look into it again when I am on my pc.

I think you can use insert layer approach to insert a layer inside footer but I haven't mastered this one yet. But may be just another buffer will be for the footer. I'll think about it later.

I think you will still need the . but I forget why. :)

Re: ManageSettings....

Reply #19

If you mean the .=, then yes. Always use ".=" when adding stuff to html_headers because others may add something as well and not using the "." you'd scrap everything away.

Re layers: I may find some time to write down an example later today.
Bugs creator.
Features destroyer.
Template killer.

Re: ManageSettings....

Reply #20

I was not sure which place you are trying to put your global footer, before or after the default footer. Now I think it should be before but inside it. You can try changing the first two functions as follows:
Code: [Select]
function GHF_Main()
{
 // Globalize what you need
 global $context, $modSettings;
 
 // Load what you need
 // eg. loadLanguage('GHF');

 // Add things in header
 if (!empty($modSettings['global_head'])) {
 $context['html_headers'] .= $modSettings['global_head'];
 }
}

function GHF_Mid(&$buffer)
{
 // Globalize what you need
 global $modSettings, $context;

 if (isset($_REQUEST['xml']) || $context['current_action'] == 'printpage') return $buffer;

 $ghf = array();

 // Description
 if(!empty($modSettings['global_mid'])) {
 // Insert the global_mid
 $ghf_old1 = '<div id="main_content_section"><a id="skipnav"></a>';
 $ghf_new1 = '<br /><div>' . $modSettings['global_mid'] . '</div>
 <div id="main_content_section"><a id="skipnav"></a>';
 $gfh[$ghf_old1] = $ghf_new1;
 
 // Insert the global_foot
 $ghf_old2 = '<div id="footer_section"><a id="bot"></a>';
 $ghf_new2 = '<div id="footer_section"><a id="bot"></a>
 <div>' . $modSettings['global_foot'] . '</div>';
 $gfh[$ghf_old2] = $ghf_new2;
 
 // Insert the global_copy
 $ghf_old3 = '<li class="copyright">';
 $ghf_new3 = '<li class="copyright">' . $modSettings['global_copy'] . '<br />';
 $gfh[$ghf_old3] = $ghf_new3;
 }
 // Now let's change the title, if we're allowed to
 return str_replace(array_keys($gfh), array_values($gfh), $buffer);
}

You should now have global footer before but inside the default footer and global copy as well.

I think the best practice would be adding layers. Let's wait for @emanuele 's note for that.
Last Edit: July 02, 2015, 06:08:19 am by ahrasis

Re: ManageSettings....

Reply #21

Side note: the "insert_after_template", means really after template, so just before the closing body tag.

Either way, now that I think about it, and judging by the replacements made by @Burke Knight, I feel using layers is not really an option, because there is not a good place to hook into, so... go for edits for the moment.
Bugs creator.
Features destroyer.
Template killer.

Re: ManageSettings....

Reply #22

@ahrasis

Works, not exactly where had the footer one on the older version, but more where wanted it, so double bonus. :)


@Spuds

I noticed, even though I left out the part about hooks in the submission of original, it says on addon site:
QuoteThis addon is 100% hooks based requiring no source edits to install.

However, this new package, will be, so not big issue on this one, but just letting you know it messed up.
Now, how do I update an addon entry?

 

Re: ManageSettings....

Reply #23

You can just update the page, commit the changes and send the PR.
Bugs creator.
Features destroyer.
Template killer.