[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!
Suggested Hosts
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
martti
Registered User
Posts: 855
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.3][BETA] Custom Code

Post by martti »

php_BB_Lover wrote:
Wed Jun 24, 2020 10:10 am
...
one more question: right now i'm testing my forum on localhost and i dont wanna redo this for final forum. would you please tell me how to integrate last part in your extension, not to repeat this again?
...
Well, just upload your 2 newly created files from your local machine to the server and clear the cache.
php_BB_Lover
Registered User
Posts: 173
Joined: Tue Jun 23, 2020 5:18 am

Re: [3.3][BETA] Custom Code

Post by php_BB_Lover »

martti wrote:
Wed Jun 24, 2020 11:27 am
php_BB_Lover wrote:
Wed Jun 24, 2020 10:10 am
...
one more question: right now i'm testing my forum on localhost and i dont wanna redo this for final forum. would you please tell me how to integrate last part in your extension, not to repeat this again?
...
Well, just upload your 2 newly created files from your local machine to the server and clear the cache.
Would you please tell me how to integrate the last part in your extension, it saves the emty file in root store folder when im installing the extension?
Version: phpBB 3.3.0
Theme: default

Regards
php_BB_Lover
Registered User
Posts: 173
Joined: Tue Jun 23, 2020 5:18 am

Re: [3.3][BETA] Custom Code

Post by php_BB_Lover »

1. Do i have to move both folders to server? [/store/customcode] and [/ext/marttiphpbb] ?

2. Can i add PHP Events (Hook Locations) too? or only i could add [Template Events] and [ACP Template Events]?
Version: phpBB 3.3.0
Theme: default

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

Re: [3.3][BETA] Custom Code

Post by martti »

Hi,
php_BB_Lover wrote:
Thu Jun 25, 2020 2:36 am
1. Do i have to move both folders to server? [/store/customcode] and [/ext/marttiphpbb] ?
If the extension is already installed on the server, only the two files to their locations.
The store/customcode directory is created by the extension when you install it. This is to separate code from data storage, so they exist independently. (This directory will later in extension development change to store/marttiphpbb/customcode to be in tune with the extension validation policies and it's more neat.)
php_BB_Lover wrote:
Thu Jun 25, 2020 2:36 am
2. Can i add PHP Events (Hook Locations) too? or only i could add [Template Events] and [ACP Template Events]?
The extension is only about template events.
php_BB_Lover
Registered User
Posts: 173
Joined: Tue Jun 23, 2020 5:18 am

Re: [3.3][BETA] Custom Code

Post by php_BB_Lover »

martti wrote:
Thu Jun 25, 2020 11:52 am
Hi,
php_BB_Lover wrote:
Thu Jun 25, 2020 2:36 am
1. Do i have to move both folders to server? [/store/customcode] and [/ext/marttiphpbb] ?
If the extension is already installed on the server, only the two files to their locations.
The store/customcode directory is created by the extension when you install it. This is to separate code from data storage, so they exist independently. (This directory will later in extension development change to store/marttiphpbb/customcode to be in tune with the extension validation policies and it's more neat.)
php_BB_Lover wrote:
Thu Jun 25, 2020 2:36 am
2. Can i add PHP Events (Hook Locations) too? or only i could add [Template Events] and [ACP Template Events]?
The extension is only about template events.
1. is it possible to put store/customcode folder in your extension folder? i think that would be good if you put everything about customcode in ext/marttiphpbb/customcode/
2. how about [ACP Template Events]?
3. isn't it possible to integrate PHP Events in customcode or you don't have plan to do that?
thanks
Version: phpBB 3.3.0
Theme: default

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

Re: [3.3][BETA] Custom Code

Post by martti »

php_BB_Lover wrote:
Thu Jun 25, 2020 9:47 pm

1. is it possible to put store/customcode folder in your extension folder? i think that would be good if you put everything about customcode in ext/marttiphpbb/customcode/
No, it's not. That's the code location. You should be able to throw away everything away there. That's what you do when you update the extension. You throw away the code and replace with the new version. The store folder is dedicated to data storage. Things are more easy to handle if you keep them seperated.
php_BB_Lover wrote:
Thu Jun 25, 2020 9:47 pm

2. how about [ACP Template Events]?
What would be the use case? That's just for the admins. I think it would go too far.
php_BB_Lover wrote:
Thu Jun 25, 2020 9:47 pm
3. isn't it possible to integrate PHP Events in customcode or you don't have plan to do that?
thanks
I don't have a plan to do that and I think it would be better to start another project for that.
Note that this extension also won't work when the "allow PHP in templates" switch is activated in the ACP. I'm not entirely sure if that switch is still there and but the phpBB extension validators got already alarmed by this extension and asked me to secure that any PHP could not be injected.

edit: small typo
Last edited by martti on Fri Jun 26, 2020 7:14 am, edited 1 time in total.
php_BB_Lover
Registered User
Posts: 173
Joined: Tue Jun 23, 2020 5:18 am

Re: [3.3][BETA] Custom Code

Post by php_BB_Lover »

@martti
Thank you very much!
Version: phpBB 3.3.0
Theme: default

Regards
User avatar
shortmort37
Registered User
Posts: 516
Joined: Sat Aug 26, 2006 8:40 pm
Location: Upper Darby, PA, USA
Name: Dan Morton
Contact:

Re: [3.3][BETA] Custom Code

Post by shortmort37 »

martti wrote:
Wed Apr 22, 2020 9:42 pm
Better move the style to the <head> ( overall_header_stylesheets_after ) because now you are repeating the same styling rules each row, which is not necessary.
You can also reduce the padding and move the text to the left to fill up the empty space:

Code: Select all

<style>
dl.row-item dt .list-inner {
    padding-left: 10px;
}
.row-item {
  background-image: none;
}
</style>
And then to apply it to one certain forum, wrap it in a conditional statement

Code: Select all

{%- if FORUM_ID == 53 -%}
<style>
 (.... your styling rules ...)
</style>
{%- endif -%}
This style works perfectly when applied to rows in a list of forum topics:
forum.JPG
...but I also find that for those forums where I apply it - e.g., {%- if FORUM_ID == 53 -%} - the padding gets applied to thumbnails within the topic itself:
topic.JPG
When I post the same image to a forum where the rules are not applied, the border is tight around the thumbnail - no padding.

Is there any way I can add specificity to this snippet, so that it only applies to the list of forum topics? For reference, here is the content of overall_header_stylesheets_after.html:

Code: Select all

{%- if (FORUM_ID in [120, 121, 122]) -%}
<style>
dl.row-item dt .list-inner {
  padding-left: 10px;
}
.row-item {
  background-image: none;
}
img {
  float:left;
  padding-left: 3px;
  padding-top: 3px;
  padding-bottom: 3px;
}
</style>
{% endif %}
Edit-

I thought perhaps putting .row-item before img in the above might provide the needed constraint, but now the text appears under the icon, no longer to the right of it:

Capture.JPG
Capture.JPG (26.25 KiB) Viewed 67 times
User avatar
shortmort37
Registered User
Posts: 516
Joined: Sat Aug 26, 2006 8:40 pm
Location: Upper Darby, PA, USA
Name: Dan Morton
Contact:

Re: [3.3][BETA] Custom Code

Post by shortmort37 »

Ah! .topiclist provides the needed constraint, for topic icon images only:

Code: Select all

.topiclist img {
  float:left;
  padding-left: 3px;
  padding-top: 3px;
  padding-bottom: 3px;
}
Problem solved!
Post Reply

Return to “Extensions in Development”

cron