[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)
Post Reply
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [BETA] Custom Code

Post by martti »

Version 0.3.0 comes with a new feature: showing (and linking to the editor) the locations where template code can be inserted with this extension:
Image
leschek
Registered User
Posts: 791
Joined: Tue Jul 18, 2006 12:49 pm
Contact:

Re: [BETA] Custom Code

Post by leschek »

Nice update. I really like clickable events displayed on the board. It make much easier to find correct file to edit.
What I don't like much is, when I click in ACP on link "Hide Custom Code template events locations" it moves me to board index, but I would prefer to stay on the same page.
User avatar
KhurramMunawar
Registered User
Posts: 534
Joined: Tue Mar 25, 2014 2:20 am
Location: Islamabad, Pakistan
Name: Khurram Munawar
Contact:

Re: [BETA] Custom Code

Post by KhurramMunawar »

thank u for the great mod. working fine. but i have a question about google adsense code placement.
if we add a code in the files given in this extension. it will violates the TOS of google adsense. coz ads are still showing in login and register pages.

can u help with it
My forum:
DearHelper.org
Get Free Traffic To Your Website
Trafficonic.com - Free Traffic To Your Website
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [BETA] Custom Code

Post by martti »

KhurramMunawar wrote:thank u for the great mod. working fine. but i have a question about google adsense code placement.
if we add a code in the files given in this extension. it will violates the TOS of google adsense. coz ads are still showing in login and register pages.

can u help with it
You could check for template variables that are present on the different pages, but for ease of use I've now added a template variable (version 0.3.2) which gives you the page name. It's called CUSTOMCODE_PAGE.
Then you could do the following:

Code: Select all

<!-- IF CUSTOMCODE_PAGE != 'ucp.php' --> 
google adsense code here...
<!-- ENDIF -->
This will block the adsense code from all pages of the ucp.php, which include register and login, but also anything else from the ucp (profile page, private messaging, board settings etc). If you want to block registering and login only, you have to check for the template variables which are present on those pages.

If you want to block also the moderator pages:

Code: Select all

<!-- IF CUSTOMCODE_PAGE != 'ucp.php' and CUSTOMCODE_PAGE != 'mcp.php' --> 
google adsense code here...
<!-- ENDIF -->
Edit: version 0.3.5 CUSTOMCODE_PAGE_NAME changed to CUSTOMCODE_PAGE
Last edited by martti on Thu Jan 01, 2015 10:17 am, edited 3 times in total.
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [BETA] Custom Code

Post by martti »

leschek wrote:Nice update. I really like clickable events displayed on the board. It make much easier to find correct file to edit.
What I don't like much is, when I click in ACP on link "Hide Custom Code template events locations" it moves me to board index, but I would prefer to stay on the same page.
This has changed now. In the latest version (0.3.2) it will stay on the same page.
User avatar
Walther
Registered User
Posts: 283
Joined: Fri Jul 09, 2004 5:21 pm
Location: The Netherlands

Re: [BETA] Custom Code

Post by Walther »

KhurramMunawar wrote:...
. it will violates the TOS of google adsense. coz ads are still showing in login and register pages.
...
I never worried much about these, but your questions lead to a nice update of this extension :)

I have now the following
<!-- IF not S_USER_LOGGED_IN and CUSTOMCODE_PAGE_NAME != 'ucp.php' -->
before the adsense code is called.
Nice work, Martti 8-)
Last edited by Walther on Mon Dec 29, 2014 11:17 am, edited 2 times in total.
User avatar
KhurramMunawar
Registered User
Posts: 534
Joined: Tue Mar 25, 2014 2:20 am
Location: Islamabad, Pakistan
Name: Khurram Munawar
Contact:

Re: [BETA] Custom Code

Post by KhurramMunawar »

martti wrote:
KhurramMunawar wrote:thank u for the great mod. working fine. but i have a question about google adsense code placement.
if we add a code in the files given in this extension. it will violates the TOS of google adsense. coz ads are still showing in login and register pages.

can u help with it
You could check for template variables that are present on the different pages, but for ease of use I've now added a template variable (version 0.3.2) which gives you the page name. It's called CUSTOMCODE_PAGE_NAME.
Then you could do the following:

Code: Select all

<!-- IF CUSTOMCODE_PAGE_NAME != 'ucp.php' --> 
google adsense code here...
<!-- ENDIF -->
This will block the adsense code from all pages of the ucp.php, which include register and login, but also anything else from the ucp (profile page, private messaging, board settings etc). If you want to block registering and login only, you have to check for the template variables which are present on those pages.

If you want to block also the moderator pages:

Code: Select all

<!-- IF CUSTOMCODE_PAGE_NAME != 'ucp.php' and CUSTOMCODE_PAGE_NAME != 'mcp.php' --> 
google adsense code here...
<!-- ENDIF -->

so you want me to update the extension ?? if so kindly tell me what is the procedure to update it .
and is it possible to insert the custom code after the first topic ??

Thank you
My forum:
DearHelper.org
Get Free Traffic To Your Website
Trafficonic.com - Free Traffic To Your Website
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [BETA] Custom Code

Post by martti »

so you want me to update the extension ?? if so kindly tell me what is the procedure to update it .
and is it possible to insert the custom code after the first topic ??
My other extension Template Events lists all template events. So you get an overview of all possible locations.
To keep it simple, the Custom Code inserts only a few common useful template events, but more could be added. For what purpose would like to have custom code after the first topic? And where exactly? In which page? (viewforum.php?)
User avatar
KhurramMunawar
Registered User
Posts: 534
Joined: Tue Mar 25, 2014 2:20 am
Location: Islamabad, Pakistan
Name: Khurram Munawar
Contact:

Re: [BETA] Custom Code

Post by KhurramMunawar »

disregard my previous message.

i have updated the extension successfully and added the new code. it is working fine according to google adsense TOS.
Thank u so much for the great work.

Now just want to place the ad code after the first topic . Is it possible ??
My forum:
DearHelper.org
Get Free Traffic To Your Website
Trafficonic.com - Free Traffic To Your Website
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [BETA] Custom Code

Post by martti »

KhurramMunawar wrote:disregard my previous message.

i have updated the extension successfully and added the new code. it is working fine according to google adsense TOS.
Thank u so much for the great work.

Now just want to place the ad code after the first topic . Is it possible ??
So you want to insert a row with an advertisement after the first topicrow in viewforum.php ?

Maybe with topiclist_row_append template event? (Not yet included.)

Image
User avatar
KhurramMunawar
Registered User
Posts: 534
Joined: Tue Mar 25, 2014 2:20 am
Location: Islamabad, Pakistan
Name: Khurram Munawar
Contact:

Re: [BETA] Custom Code

Post by KhurramMunawar »

My other extension Template Events lists all template events. So you get an overview of all possible locations.
To keep it simple, the Custom Code inserts only a few common useful template events, but more could be added. For what purpose would like to have custom code after the first topic? And where exactly? In which page? (viewforum.php?)
i want to add google adsense code after the first topic is posted . i.e
if u post a new thread on the forum, after hitting submit you will see your the google adsense underneath your question or thread you posted.

and if someone replies to that thread than google adsense will be in the center of topic and reply.

hope u understand what i mean to say :) sorry for my band English. :)
My forum:
DearHelper.org
Get Free Traffic To Your Website
Trafficonic.com - Free Traffic To Your Website
User avatar
spaceace
Registered User
Posts: 1994
Joined: Wed Jan 30, 2008 8:50 pm
Contact:

Re: [BETA] Custom Code

Post by spaceace »

KhurramMunawar wrote:i want to add google adsense code after the first topic is posted . i.e
if u post a new thread on the forum, after hitting submit you will see your the google adsense underneath your question or thread you posted.

and if someone replies to that thread than google adsense will be in the center of topic and reply.

hope u understand what i mean to say :) sorry for my band English. :)
i know exactly what you are wanting. there was a MOD for phpBB 3.0.X that did this...

within a new/old topic...

first post - first post
second post - has the ad content in it
thirst post - has a reply that someone has made

it turns what would be the second post of all topics into an advertisement
User avatar
KhurramMunawar
Registered User
Posts: 534
Joined: Tue Mar 25, 2014 2:20 am
Location: Islamabad, Pakistan
Name: Khurram Munawar
Contact:

Re: [BETA] Custom Code

Post by KhurramMunawar »

i know exactly what you are wanting. there was a MOD for phpBB 3.0.X that did this...

within a new/old topic...

first post - first post
second post - has the ad content in it
thirst post - has a reply that someone has made

it turns what would be the second post of all topics into an advertisement
exactly mate . you got it
My forum:
DearHelper.org
Get Free Traffic To Your Website
Trafficonic.com - Free Traffic To Your Website
User avatar
2600
I've Been Banned!
Posts: 2567
Joined: Fri Nov 14, 2014 5:14 pm
Location: Area-51

Re: [BETA] Custom Code

Post by 2600 »

I'm going to add adsense to my site as well using this extension. I hope I don't have too much trouble as I am not to good with code, especially PHP.
Morpheus: Unfortunately, no one can be told what The Matrix is. You'll have to see it for yourself.
Hack me.
Consider a canary token.
The nature of my chosen username
:ugeek:
Post Reply

Return to “Extensions in Development”