[ABD] Custom Code

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
User avatar
martti
Registered User
Posts: 914
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

GoBieN wrote:Is there a list somewhere with TEMPLATE variables I can use?
Like SCRIPT_NAME and such?
It varies from page to page. Here is a list which is common to all pages:
https://github.com/phpbb/phpbb/blob/3.1 ... .php#L5099
User avatar
martti
Registered User
Posts: 914
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

Mauron wrote:Any news about the official release in extension database?
Some languages do not have all keys yet. Help is welcome on (use pull requests):
  • Arabic (ar)
  • Dutch (nl)
  • Turkish (tr)
If they won't get completed, they can't be included in the release.
User avatar
GoBieN
Registered User
Posts: 546
Joined: Fri Mar 05, 2004 5:22 pm
Location: Belgium

Re: [RC] Custom Code

Post by GoBieN »

I have also found this:
https://wiki.phpbb.com/Viewtopic_Template_Variables
Don't know how up to date it is.
For instance to get the URL of the current viewtopic page i need to use {BOARD_URL}{U_VIEWTOPIC}

But that generates: http://www.example.com/forum/./viewtopic.php?f=x&t=y
It works but it's not pretty.
Last edited by GoBieN on Thu Jul 02, 2015 9:00 pm, edited 1 time in total.
User avatar
GoBieN
Registered User
Posts: 546
Joined: Fri Mar 05, 2004 5:22 pm
Location: Belgium

Re: [RC] Custom Code

Post by GoBieN »

Seems my sharing script had a problem with the & in the URL and javascript encoding broke it as well.
So i now used:
data-url="{BOARD_URL}{SCRIPT_NAME}.php?t={TOPIC_ID}"
User avatar
thunderchero
Registered User
Posts: 129
Joined: Sun Nov 03, 2013 10:16 pm

Re: [RC] Custom Code

Post by thunderchero »

martti wrote:
Mauron wrote:Any news about the official release in extension database?
Some languages do not have all keys yet. Help is welcome on (use pull requests):
  • Arabic (ar)
  • Dutch (nl)
  • Turkish (tr)
If they won't get completed, they can't be included in the release.
This made me think they should validate language packs separately? :D

hope to see it released soon.

thunderchero
romeo_piter
Registered User
Posts: 130
Joined: Mon Nov 09, 2009 7:11 pm
Location: Paraguay

Re: [RC] Custom Code

Post by romeo_piter »

This path:

Code: Select all

<!-- INCLUDE ../../../../../../store/customcode/new.html -->
does not work for me:

Code: Select all

Uncaught exception 'Twig_Error_Loader' with message 'Unable to find template "../../../../../../store/customcode/new.html"
But the file exists.

Maybe the problem is that my forum is on subdomen: forum.site

Could you please help?
kooljp
Registered User
Posts: 29
Joined: Thu Feb 14, 2013 11:52 pm

Re: [RC] Custom Code

Post by kooljp »

<!-- Baby chickens in headerbar styling -->
<style>
.headerbar {
background-image: url("{ROOT_PATH}images/baby_chickens.jpg");
}

/** remove the logo and increase the height of the headerbar **/
.imageset.site_logo {
background-image: none;
padding-left: 0;
padding-top: 100px;
}
</style>
How do you scale the width and height of the background image to be Responsive?
User avatar
martti
Registered User
Posts: 914
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

kooljp wrote: How do you scale the width and height of the background image to be Responsive?
Edit : overall_header_stylesheets_after.hml

Code: Select all

<!-- Baby chickens in headerbar styling -->
<style>
.headerbar {
	background-image: url("{ROOT_PATH}images/baby_chickens.jpg");
	background-size:   cover;                  
	background-repeat: no-repeat;
	background-position: center center; 
}

/** remove the logo and increase the height of the headerbar **/
.imageset.site_logo {
	background-image: none;
	padding-left: 0;
	padding-top: 100px;
}
</style>
kooljp
Registered User
Posts: 29
Joined: Thu Feb 14, 2013 11:52 pm

Re: [RC] Custom Code

Post by kooljp »

Thanks martti, works perfectly.

Is there a way to make the image a clickable link to the homepage?

Cheers
JP
User avatar
martti
Registered User
Posts: 914
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

kooljp wrote:Thanks martti, works perfectly.

Is there a way to make the image a clickable link to the homepage?

Cheers
JP
Then add the following:

Edit : overall_footer_after.html

Code: Select all

<!-- Clickable headerbar -->
<script>
var headerbar = document.querySelector('.headerbar');
if (headerbar)
{
	headerbar.addEventListener('click', function(){
		window.location = '{{ U_SITE_HOME ? U_SITE_HOME : U_INDEX }}';
	});
	headerbar.title = '{{ U_SITE_HOME ? L_SITE_HOME : L_INDEX }}';
	headerbar.style.cursor = 'pointer';
}
</script>
User avatar
martti
Registered User
Posts: 914
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

romeo_piter wrote:This path:

Code: Select all

<!-- INCLUDE ../../../../../../store/customcode/new.html -->
does not work for me:

Code: Select all

Uncaught exception 'Twig_Error_Loader' with message 'Unable to find template "../../../../../../store/customcode/new.html"
But the file exists.

Maybe the problem is that my forum is on subdomen: forum.site

Could you please help?
Was the file created with the extension itself?
kooljp
Registered User
Posts: 29
Joined: Thu Feb 14, 2013 11:52 pm

Re: [RC] Custom Code

Post by kooljp »

martti wrote:
kooljp wrote:Thanks martti, works perfectly.

Is there a way to make the image a clickable link to the homepage?

Cheers
JP
Then add the following:

Edit : overall_footer_after.html

Code: Select all

<!-- Clickable headerbar -->
<script>
var headerbar = document.querySelector('.headerbar');
if (headerbar)
{
	headerbar.addEventListener('click', function(){
		window.location = '{{ U_SITE_HOME ? U_SITE_HOME : U_INDEX }}';
	});
	headerbar.title = '{{ U_SITE_HOME ? L_SITE_HOME : L_INDEX }}';
	headerbar.style.cursor = 'pointer';
}
</script>
Added this code and refreshed the cache.

Didn't appear to work:
Board is http://www.fishing-victoria.com/

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

Re: [RC] Custom Code

Post by martti »

kooljp wrote:
martti wrote:
kooljp wrote:Thanks martti, works perfectly.

Is there a way to make the image a clickable link to the homepage?

Cheers
JP
Then add the following:

Edit : overall_footer_after.html

Code: Select all

<!-- Clickable headerbar -->
<script>
var headerbar = document.querySelector('.headerbar');
if (headerbar)
{
	headerbar.addEventListener('click', function(){
		window.location = '{{ U_SITE_HOME ? U_SITE_HOME : U_INDEX }}';
	});
	headerbar.title = '{{ U_SITE_HOME ? L_SITE_HOME : L_INDEX }}';
	headerbar.style.cursor = 'pointer';
}
</script>
Added this code and refreshed the cache.

Didn't appear to work:
Board is http://www.fishing-victoria.com/

Cheers

You've put the code in overall_header_stylesheets_after.html, but I gave you Edit : overall_footer_after.html
overall_stylesheets_after.html doesn't work because at this position the .headerbar div is not rendered yet. So document.querySelector('.headerbar'); returns null.
kooljp
Registered User
Posts: 29
Joined: Thu Feb 14, 2013 11:52 pm

Re: [RC] Custom Code

Post by kooljp »

martti wrote:
You've put the code in overall_header_stylesheets_after.html, but I gave you Edit : overall_footer_after.html
overall_stylesheets_after.html doesn't work because at this position the .headerbar div is not rendered yet. So document.querySelector('.headerbar'); returns null.
oops :roll:

All good now and working as expected!
Many thanks
User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: [RC] Custom Code

Post by Oyabun1 »

Meykota wrote:So is it's possible to hide my ads from my registered users? Only guests shall see those ads. Would be great :)
Galixte de EzCom wrote:more like this:

Code: Select all

<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
"your code"
<!-- ENDIF -->
You don't really want the and not S_IS_BOT condition in there. That would be saying, if you are not a bot show the ads, but hiding the ads from bots probably isn't a good idea, particularly if you use Adsense.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests

Return to “Abandoned Extensions”