[3.3][BETA] Custom Code

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
Lumpy Burgertushie
Registered User
Posts: 68195
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: [RC] Custom Code

Post by Lumpy Burgertushie »

wow, for some reason, I thought you had specified adsense in your post above.

sorry about that.

and yes, the index page is content, it has the forum list etc. on it.


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
User avatar
SalazarAG
Registered User
Posts: 677
Joined: Mon Mar 30, 2015 10:48 am

Re: [RC] Custom Code

Post by SalazarAG »

Boys, can you help me?

I can add events with an extension somewhere in the forum?

I created the event "forumlist_body_last_post_title_prepend.html" to display the prefixes created with the extension "Quick Title Edition" in the title of the last post in the list of forums, but has not worked.

After creating the "forumlist_body_last_post_title_prepend.html" event, I added the following code:

Code: Select all

<!-- IF topicrow.TOPIC_ATTRIBUTE -->{topicrow.TOPIC_ATTRIBUTE} <!-- ENDIF -->
This code I took the file ./ext/abdev/qte/styles/prosilver/template/event/topiclist_row_prepend.html

But it did not work!

So it's possible with the extension Custom Code to add parts of another extension with events?
I'm sorry for my English. Google Translator does a bad job. :D
User avatar
Mauron
Registered User
Posts: 342
Joined: Wed Jul 16, 2014 11:25 am

Re: [RC] Custom Code

Post by Mauron »

wat

That event is not available in phpBB 3.1.5.
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

Mauron wrote:wat

That event is not available in phpBB 3.1.5.
It is a template event: https://wiki.phpbb.com/Event_List#topiclist_row_prepend
SalazarAG wrote:Boys, can you help me?

I can add events with an extension somewhere in the forum?

I created the event "forumlist_body_last_post_title_prepend.html" to display the prefixes created with the extension "Quick Title Edition" in the title of the last post in the list of forums, but has not worked.

After creating the "forumlist_body_last_post_title_prepend.html" event, I added the following code:

Code: Select all

<!-- IF topicrow.TOPIC_ATTRIBUTE -->{topicrow.TOPIC_ATTRIBUTE} <!-- ENDIF -->
This code I took the file ./ext/abdev/qte/styles/prosilver/template/event/topiclist_row_prepend.html

But it did not work!

So it's possible with the extension Custom Code to add parts of another extension with events?
That template event is not included in this extension. In order to keep the extension simple, only a limited set of template events is included. These should cover already a lot of flexibility and use cases. If you need to put some template code on a place where this extension has no template event available, then your options are:
  • Use javascript to move your code to this place. Put your code in a div element in the overall_footer_after template event and then move it in its location with Javascript. See an example here
  • Fork this extension and include the template event(s) you need. See here how to do this. Here is the repository on Github.
Because this question has been asked several times, I've added this answer to the end of the second post of this topic.
rrbailey89
Registered User
Posts: 248
Joined: Fri Oct 24, 2014 3:00 pm

Re: [RC] Custom Code

Post by rrbailey89 »

I would like to use custome code if possible to embed something below the Recent Topics extension while using the PBTech Style. Is this possible?

Please see this post for a snippet of the code and a pic of what im talking about.

viewtopic.php?p=14189301#p14189116

Also here is probably a better pic.

Image

That is a snippet of the area on my index page where I would like to embed the code.
User avatar
SalazarAG
Registered User
Posts: 677
Joined: Mon Mar 30, 2015 10:48 am

Re: [RC] Custom Code

Post by SalazarAG »

martti wrote:
Mauron wrote:wat

That event is not available in phpBB 3.1.5.
It is a template event: https://wiki.phpbb.com/Event_List#topiclist_row_prepend
SalazarAG wrote:Boys, can you help me?

I can add events with an extension somewhere in the forum?

I created the event "forumlist_body_last_post_title_prepend.html" to display the prefixes created with the extension "Quick Title Edition" in the title of the last post in the list of forums, but has not worked.

After creating the "forumlist_body_last_post_title_prepend.html" event, I added the following code:

Code: Select all

<!-- IF topicrow.TOPIC_ATTRIBUTE -->{topicrow.TOPIC_ATTRIBUTE} <!-- ENDIF -->
This code I took the file ./ext/abdev/qte/styles/prosilver/template/event/topiclist_row_prepend.html

But it did not work!

So it's possible with the extension Custom Code to add parts of another extension with events?
That template event is not included in this extension. In order to keep the extension simple, only a limited set of template events is included. These should cover already a lot of flexibility and use cases. If you need to put some template code on a place where this extension has no template event available, then your options are:
  • Use javascript to move your code to this place. Put your code in a div element in the overall_footer_after template event and then move it in its location with Javascript. See an example here
  • Fork this extension and include the template event(s) you need. See here how to do this. Here is the repository on Github.
Because this question has been asked several times, I've added this answer to the end of the second post of this topic.
Thank you, Mart!
I'm sorry for my English. Google Translator does a bad job. :D
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

rrbailey89 wrote:I would like to use custome code if possible to embed something below the Recent Topics extension while using the PBTech Style. Is this possible?

Please see this post for a snippet of the code and a pic of what im talking about.

viewtopic.php?p=14189301#p14189116

Also here is probably a better pic.

Image

That is a snippet of the area on my index page where I would like to embed the code.
I've tried with prosilver, but with another style it should also be possible:

Edit : forumlist_body_category_header_before.html

Code: Select all

<!-- content before forums on index page -->

<!-- IF SCRIPT_NAME == 'index' and forumrow.S_FIRST_ROW -->

Your content ...

<!-- ENDIF -->
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

New version 1.1.0

Changes:
  • As an extra security measure, your custom codes are now disabled when inclusion of PHP code with PHP or INCLUDEPHP statements is enabled.
  • New template event included: overall_footer_body_after This will be handy to include Javascript that contains jQuery.
One langauge string was added: ACP_CUSTOMCODE_INCLUDEPHP_WARNING

When inclusion of PHP in templates with PHP or INCLUDEPHP statements is enabled, you get this warning:
Image

To update:
  • Disable the extension.
  • Delete the contents of directory ext/marttiphpbb/customcode
  • Download, unpack and put the new version in place of the old one.
  • Enable the extension.
Last edited by martti on Sat Sep 05, 2015 9:56 am, edited 1 time in total.
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

martti wrote:New version 1.1.0

Changes:
  • As an extra security measure, your custom codes are now disabled when inclusion of PHP code with PHP or INCLUDEPHP statements is enabled.
  • New template event included: overall_footer_body_after This will be handy to include Javascript that contains jQuery.
One langauge string was added: ACP_CUSTOMCODE_INCLUDEPHP_WARNING

When inclusion of PHP in templates with PHP or INCLUDEPHP statements is enabled, you get this warning:
Image

To update:
  • Disable the extension.
  • Delete the contents of directory ext/marttiphpbb/customcode
  • Download, unpack and put the new version in place of the old one.
  • Enable the extension.
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

The newly included overall_footer_body_after template event is the ideal place to insert some Javascript.

Here below an updated example on how to move some content in place with Javascript:
(This is an update of this answer.)

Edit : overall_footer_body_after

Code: Select all

<!-- append social icons to breadcrumbs section -->

<li class="rightside responsive-hide" style="display: none;" id="my-social-icon">
    My icon here ...
</li>

<script>
$(document).ready( function() {
    var mySocialIcon = $('#my-social-icon');
    $('#nav-breadcrumbs').append(mySocialIcon);
    mySocialIcon.css( "display", "inline" ); 
});
</script>
Image
User avatar
Galixte de EzCom
Registered User
Posts: 1090
Joined: Mon Oct 04, 2004 11:14 pm
Location: France
Name: Raphaël M.
Contact:

Re: [RC] Custom Code

Post by Galixte de EzCom »

Hi martti,

the new language key should be: 'ACP_CUSTOMCODE_INCLUDEPHP_WARNING' => 'Warning! For security, your custom code will not be included in templates when PHP code inclusion with PHP and INCLUDEPHP statements is DISABLED on your board. See %ssecurity settings%s to switch ON PHP inclusion in templates.',

…instead of: 'ACP_CUSTOMCODE_INCLUDEPHP_WARNING' => 'Warning! For security, your custom code will not be included in templates when PHP code inclusion with PHP and INCLUDEPHP statements is enabled on your board. See %ssecurity settings%s to switch off PHP inclusion in templates.', ?

I don't understand, if i activate this setting, all my custom codes (even if i not use PHP inclusion) will be disabled ?
Communau EzCom
📖 « Traductions d’extensions & styles pour phpBB 3.2.x & 3.3.x ».
📋 Lists of all extensions identified for phpBB 3.1.x & 3.2.x.
📋 Lists of all styles identified for phpBB 3.1.x & 3.2.x.
Image Tu as un forum et tu veux aussi un site web ? Regarde par ici.
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

Galixte de EzCom wrote:Hi martti,

the new language key should be: 'ACP_CUSTOMCODE_INCLUDEPHP_WARNING' => 'Warning! For security, your custom code will not be included in the templates when PHP inclusion with the INCLUDEPHP tag is NOT allowed on your board. See %ssecurity settings%s to switch ON the INCLUDEPHP tag.',

…instead of: 'ACP_CUSTOMCODE_INCLUDEPHP_WARNING' => 'Warning! For security, your custom code will not be included in the templates when PHP inclusion with the INCLUDEPHP tag is allowed on your board. See %ssecurity settings%s to switch off the INCLUDEPHP tag.', ?

I don't understand, if i activate this setting, all my custom codes (even if i not use PHP inclusion) will be disabled ?
Yes, as it says. If you enable the PHP and INCLUDEPHP statements, your custom codes are disabled.
User avatar
Galixte de EzCom
Registered User
Posts: 1090
Joined: Mon Oct 04, 2004 11:14 pm
Location: France
Name: Raphaël M.
Contact:

Re: [RC] Custom Code

Post by Galixte de EzCom »

Ok, thanks.
Communau EzCom
📖 « Traductions d’extensions & styles pour phpBB 3.2.x & 3.3.x ».
📋 Lists of all extensions identified for phpBB 3.1.x & 3.2.x.
📋 Lists of all styles identified for phpBB 3.1.x & 3.2.x.
Image Tu as un forum et tu veux aussi un site web ? Regarde par ici.
rrbailey89
Registered User
Posts: 248
Joined: Fri Oct 24, 2014 3:00 pm

Re: [RC] Custom Code

Post by rrbailey89 »

martti wrote:
rrbailey89 wrote:I would like to use custome code if possible to embed something below the Recent Topics extension while using the PBTech Style. Is this possible?

Please see this post for a snippet of the code and a pic of what im talking about.

viewtopic.php?p=14189301#p14189116

Also here is probably a better pic.

Image

That is a snippet of the area on my index page where I would like to embed the code.
I've tried with prosilver, but with another style it should also be possible:

Edit : forumlist_body_category_header_before.html

Code: Select all

<!-- content before forums on index page -->

<!-- IF SCRIPT_NAME == 'index' and forumrow.S_FIRST_ROW -->

Your content ...

<!-- ENDIF -->
Hello Martti,

Thanks for replying, I did what you said but it inserts the content aligned to the left. Is it possible to insert it directly under the Recent Topics extension, and without pushing other things down since it appears to be free space there in this screenshot?

Image
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

rrbailey89 wrote:
Hello Martti,

Thanks for replying, I did what you said but it inserts the content aligned to the left. Is it possible to insert it directly under the Recent Topics extension, and without pushing other things down since it appears to be free space there in this screenshot?

Image
Ok, it seems some Javascript has to be used to move the content in place.
In the PBTech style the overall_footer_body_after event is not present (yet) so we have to use overall_footer_after.

Edit : overall_footer_after

Code: Select all

<!-- add content in index right div in PBTech style -->

<!-- IF SCRIPT_NAME == 'index' -->

<div id="my-content">
    My content ...
</div>

<script>
$(document).ready( function() {
  window.setTimeout( function() {
    $('div.index-right').eq(0).append($('div#my-content'));
  }, 100);
});
</script>

<!-- ENDIF -->
Post Reply

Return to “Extensions in Development”