[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.
Locked
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

Lumpy Burgertushie wrote:I am curious why all of the currently available events are not included in this extension.
Wouldn't give that a considerable cache warm-up time?

also, can we just create a new event html file by duplicating one of the ones you have to accomodate an event that you don't have one for yet?

robert
You need to adapt, exent the code of the extension itself.

(With a php event inside the template event listener probably this could be much more flexible.)
User avatar
Lumpy Burgertushie
Registered User
Posts: 69189
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: [RC] Custom Code

Post by Lumpy Burgertushie »

don't follow either one of those statement.

here is what I am trying to do;

I want to make the admin's avatar a link to somewhere else.

I have the following code that works when I put it in the viewtopic_body.html file directly:

Code: Select all

					<!-- IF postrow.POSTER_ID eq 2 -->

<!-- IF postrow.POSTER_AVATAR -->
						<!-- IF postrow.U_POST_AUTHOR --><a href="http://phpbbace.com" class="avatar">{postrow.POSTER_AVATAR}</a><!-- ELSE --><span class="avatar">{postrow.POSTER_AVATAR}</span><!-- ENDIF -->
					<!-- ENDIF -->

<!-- ELSE -->
<!-- IF postrow.POSTER_AVATAR -->
						<!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}" class="avatar">{postrow.POSTER_AVATAR}</a><!-- ELSE --><span class="avatar">{postrow.POSTER_AVATAR}</span><!-- ENDIF -->
					<!-- ENDIF -->
<!-- ENDIF -->
since, in this extension, there are no files for <!-- EVENT viewtopic_body_avatar_before -->or
<!-- EVENT viewtopic_body_avatar_after -->

how do I use those events to put my code before and after the default code as above?

thanks,
robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

Lumpy Burgertushie wrote: how do I use those events to put my code before and after the default code as above?
To alter the extension to include other template events:
  • In the extension directory, in file model/customcode_directory.php you add your events to the array $template_events The keys are the names of the events and the values are the preset content when enabling the extension.
  • Then, go to directory styles/all/template/event and copy paste one of the template events which are there, for example overall_header_content_before.html (Do NOT copy overall_header_body_before, overall_header_head_append or overall_header_stylesheets_after) .
  • Rename the file to your template event and open the file and rename all occurences of overall_header_content_before both lower case and upper case instances.
    U_CUSTOMCODE_OVERALL_HEADER_CONTENT_BEFORE becomes for example U_CUSTOMCODE_VIEWTOPIC_BODY_AVATAR_BEFORE
  • Then, disable and enable the extension.
(You could consider forking with git / github then it's easier if you want to pull any changes later.)

Another reason only a limited set of events is included is to keep it simple; including the entire list of events might be overwhelming.
User avatar
Lumpy Burgertushie
Registered User
Posts: 69189
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: [RC] Custom Code

Post by Lumpy Burgertushie »

very good. thank you. I figured it would be something like that but I just did not go far enough.

I think this extension alone could replace a whole lot of others that only add things to the templates.

not sure why having a default template file for each of the available events would be overwhelming for anyone. well, maybe for you to have to do all the work. ;)

thanks again,

robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
User avatar
alhitary
Registered User
Posts: 868
Joined: Wed Jan 17, 2007 7:51 am
Location: ROY
Name: Basil Taha Alhitary
Contact:

Re: [RC] Custom Code

Post by alhitary »

I installed and enabled this extension, but when i click on the ext. model in ACP, it goes to white page.
Whats the problem ?
User avatar
PayBas
Former Team Member
Posts: 930
Joined: Thu May 25, 2006 12:37 am

Re: [RC] Custom Code

Post by PayBas »

Gotta give props for this original idea.
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

alhitary wrote:I installed and enabled this extension, but when i click on the ext. model in ACP, it goes to white page.
Whats the problem ?
I'm not experiencing any problem.
Where exactly? The extensions tab in ACP?
What's the error message? (See the logs.)
User avatar
Puchahawa
Registered User
Posts: 769
Joined: Sat Jan 01, 2011 10:33 pm
Name: Randy

Re: [RC] Custom Code

Post by Puchahawa »

martti wrote:
Puchahawa wrote:My question is when I look at the image on the re-auth page the boarder images don't show up. They show correctly on the index page for the site. I'm wondering if I need to put the image files for the border in another image folder too so they show up on the re-auth page? The image below is from the re-auth page and you can see the place holders where the images should be.

Your help on the final dilemma is greatly appreciated. Randy
I don't know why. In my test forum images show up as well on the admin login. I have to see the code for this. But maybe it's not important anymore when you can suppress them?
Hi Martti, Your help with my request for info was greatly appreciated and it works great. I was just re-reading this topic and thought that you may find an answer to the question you shared above if I shared the code, so here it is.

Code: Select all

<form method="post" action="./ucp.php?mode=login">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="18" height="18"><img src="./styles/aero black/theme/images/tl.png" width="18" height="18" alt="" /></td>
    <td height="18" style="background:url('./styles/aero black/theme/images/tm.png');"></td>
	<td width="18" height="18"><img src="./styles/aero black/theme/images/tr.png" width="18" height="18" alt="" /></td>
	<td width="18" height="18"></td>
	<td width="18" height="18"><img src="./styles/aero black/theme/images/tl.png" width="18" height="18" alt="" /></td>
	<td height="18" style="background:url('./styles/aero black/theme/images/tm.png');"></td>
	<td width="18" height="18"><img src="./styles/aero black/theme/images/tr.png" width="18" height="18" alt="" /></td>
  </tr>
  <tr>
    <td width="18" style="background:url('./styles/aero black/theme/images/ml.png');"></td>
	<td><a href="http://projectcamelotportal.com/" target="_blank"><img src="http://www.freedomcrowsnest.org/images/index/projcam.jpg" /></a></td>
    <td width="18" style="background:url('./styles/aero black/theme/images/mr.png');"></td>
	
	<td width="100%" valign="middle">	
	<table border="0" cellspacing="0">
	<tr>
		<td width="18" height="18"><img src="./styles/aero black/theme/images/tl.png" width="18" height="18" alt="" /></td>
		<td width="100%" height="18" style="background:url('./styles/aero black/theme/images/tm.png');"></td>
		<td width="18" height="18"><img src="./styles/aero black/theme/images/tr.png" width="18" height="18" alt="" /></td>
	</tr>
	<tr>
	    <td width="18" style="background:url('./styles/aero black/theme/images/ml.png');"></td>
		
		<td>
		<table border="0" cellspacing="0" width="100%">
		<tr>		
			<td width="40%" class="row1" style="background-color:black" align="right"><br><br><span style="font-size:12px;color:white;font-weight:bold"></font><br><br><br></td>
			<td width="20%" class="row1" style="background-color:black" align="center"><br><br><span style="font-size:12px;color:white;font-weight:bold"><img src="http://www.freedomcrowsnest.org/images/index/yy.gif" /></font><br><br><br></td>
			<td width="40%" class="row1" style="background-color:black" align="left"><br><br><span style="font-size:12px;color:white;font-weight:bold"></font><br><br><br></td>
		</tr>
		</table>
		</td>		
		
	    <td width="18" style="background:url('./styles/aero black/theme/images/mr.png');"></td>
	</tr>
	<tr>
		<td width="18" height="18"><img src="./styles/aero black/theme/images/bl.png" width="18" height="18" alt="" /></td>    
		<td width="100%" height="18" style="background:url('./styles/aero black/theme/images/bm.png');"></td>
		<td width="18" height="18"><img src="./styles/aero black/theme/images/br.png" width="18" height="18" alt="" /></td>
	</tr>
	</table>	
    </td>
		
    <td width="18" style="background:url('./styles/aero black/theme/images/ml.png');"></td>
	<td><a href="http://front.moveon.org/" target="_blank"><img src="http://www.freedomcrowsnest.org/images/index/mo.jpg" /></a></td>
    <td width="18" style="background:url('./styles/aero black/theme/images/mr.png');"></td>
  </tr>
  <tr>
    <td width="18" height="18"><img src="./styles/aero black/theme/images/bl.png" width="18" height="18" alt="" /></td>    
	<td height="18" style="background:url('./styles/aero black/theme/images/bm.png');"></td>
	<td width="18" height="18"><img src="./styles/aero black/theme/images/br.png" width="18" height="18" alt="" /></td>
	<td width="18" height="18"></td>  
	<td width="18" height="18"><img src="./styles/aero black/theme/images/bl.png" width="18" height="18" alt="" /></td>  
	<td height="18" style="background:url('./styles/aero black/theme/images/bm.png');"></td>
	<td width="18" height="18"><img src="./styles/aero black/theme/images/br.png" width="18" height="18" alt="" /></td>
  </tr>
</table>
	
    <input type="hidden" name="redirect" value="./index.php?" />

	</form>
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

Puchahawa wrote: Hi Martti, Your help with my request for info was greatly appreciated and it works great. I was just re-reading this topic and thought that you may find an answer to the question you shared above if I shared the code, so here it is.

Code: Select all

<form method="post" action="./ucp.php?mode=login">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="18" height="18"><img src="./styles/aero black/theme/images/tl.png" width="18" height="18" alt="" /></td>
    <td height="18" style="background:url('./styles/aero black/theme/images/tm.png');"></td>
	<td width="18" height="18"><img src="./styles/aero black/theme/images/tr.png" width="18" height="18" alt="" /></td>
	<td width="18" height="18"></td>
	<td width="18" height="18"><img src="./styles/aero black/theme/images/tl.png" width="18" height="18" alt="" /></td>
	<td height="18" style="background:url('./styles/aero black/theme/images/tm.png');"></td>
	<td width="18" height="18"><img src="./styles/aero black/theme/images/tr.png" width="18" height="18" alt="" /></td>
  </tr>
  <tr>
    <td width="18" style="background:url('./styles/aero black/theme/images/ml.png');"></td>
	<td><a href="http://projectcamelotportal.com/" target="_blank"><img src="http://www.freedomcrowsnest.org/images/index/projcam.jpg" /></a></td>
    <td width="18" style="background:url('./styles/aero black/theme/images/mr.png');"></td>
	
	<td width="100%" valign="middle">	
	<table border="0" cellspacing="0">
	<tr>
		<td width="18" height="18"><img src="./styles/aero black/theme/images/tl.png" width="18" height="18" alt="" /></td>
		<td width="100%" height="18" style="background:url('./styles/aero black/theme/images/tm.png');"></td>
		<td width="18" height="18"><img src="./styles/aero black/theme/images/tr.png" width="18" height="18" alt="" /></td>
	</tr>
	<tr>
	    <td width="18" style="background:url('./styles/aero black/theme/images/ml.png');"></td>
		
		<td>
		<table border="0" cellspacing="0" width="100%">
		<tr>		
			<td width="40%" class="row1" style="background-color:black" align="right"><br><br><span style="font-size:12px;color:white;font-weight:bold"></font><br><br><br></td>
			<td width="20%" class="row1" style="background-color:black" align="center"><br><br><span style="font-size:12px;color:white;font-weight:bold"><img src="http://www.freedomcrowsnest.org/images/index/yy.gif" /></font><br><br><br></td>
			<td width="40%" class="row1" style="background-color:black" align="left"><br><br><span style="font-size:12px;color:white;font-weight:bold"></font><br><br><br></td>
		</tr>
		</table>
		</td>		
		
	    <td width="18" style="background:url('./styles/aero black/theme/images/mr.png');"></td>
	</tr>
	<tr>
		<td width="18" height="18"><img src="./styles/aero black/theme/images/bl.png" width="18" height="18" alt="" /></td>    
		<td width="100%" height="18" style="background:url('./styles/aero black/theme/images/bm.png');"></td>
		<td width="18" height="18"><img src="./styles/aero black/theme/images/br.png" width="18" height="18" alt="" /></td>
	</tr>
	</table>	
    </td>
		
    <td width="18" style="background:url('./styles/aero black/theme/images/ml.png');"></td>
	<td><a href="http://front.moveon.org/" target="_blank"><img src="http://www.freedomcrowsnest.org/images/index/mo.jpg" /></a></td>
    <td width="18" style="background:url('./styles/aero black/theme/images/mr.png');"></td>
  </tr>
  <tr>
    <td width="18" height="18"><img src="./styles/aero black/theme/images/bl.png" width="18" height="18" alt="" /></td>    
	<td height="18" style="background:url('./styles/aero black/theme/images/bm.png');"></td>
	<td width="18" height="18"><img src="./styles/aero black/theme/images/br.png" width="18" height="18" alt="" /></td>
	<td width="18" height="18"></td>  
	<td width="18" height="18"><img src="./styles/aero black/theme/images/bl.png" width="18" height="18" alt="" /></td>  
	<td height="18" style="background:url('./styles/aero black/theme/images/bm.png');"></td>
	<td width="18" height="18"><img src="./styles/aero black/theme/images/br.png" width="18" height="18" alt="" /></td>
  </tr>
</table>
	
    <input type="hidden" name="redirect" value="./index.php?" />

	</form>
viewtopic.php?f=456&t=2275361&start=135#p13893141

As leschek wrote, use template variable ROOT_PATH,

<img src="./styles/aero black/theme/images/tl.png" width="18" height="18" alt="" />
becomes
<img src="{ROOT_PATH}/styles/aero black/theme/images/tl.png" width="18" height="18" alt="" />
User avatar
alhitary
Registered User
Posts: 868
Joined: Wed Jan 17, 2007 7:51 am
Location: ROY
Name: Basil Taha Alhitary
Contact:

Re: [RC] Custom Code

Post by alhitary »

martti wrote: I'm not experiencing any problem.
Where exactly? The extensions tab in ACP?
What's the error message? (See the logs.)
Yes, The problem is extensions tab, when I click on it ( after I installed the extension and enable it ), it show white page.

See the logos is :-
Image

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

Re: [RC] Custom Code

Post by martti »

alhitary wrote:
martti wrote: I'm not experiencing any problem.
Where exactly? The extensions tab in ACP?
What's the error message? (See the logs.)
Yes, The problem is extensions tab, when I click on it ( after I installed the extension and enable it ), it show white page.

See the logos is :-
Image

Image
I meant the server logs. I tried also with Arabic now and still don't encounter a problem.

Do you have enabled debug mode? If not, you can enable it in config.php and maybe you get an explanation about the error when you go to the page again.
User avatar
alhitary
Registered User
Posts: 868
Joined: Wed Jan 17, 2007 7:51 am
Location: ROY
Name: Basil Taha Alhitary
Contact:

Re: [RC] Custom Code

Post by alhitary »

Dear martti

I enabled the debug in config :

Code: Select all

@define('PHPBB_INSTALLED', true);
// @define('PHPBB_DISPLAY_LOAD_TIME', true);
define('DEBUG', true);
// @define('DEBUG_EXTRA', true);
// @define('DEBUG_CONTAINER', true);
?>
it shows the bellow problem :

Code: Select all

[phpBB Debug] PHP Notice: in file [ROOT]/includes/functions_module.php on line 956: Undefined property: marttiphpbb/customcode/acp/main_module::$tpl_name
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

alhitary wrote:

Code: Select all

[phpBB Debug] PHP Notice: in file [ROOT]/includes/functions_module.php on line 956: Undefined property: marttiphpbb/customcode/acp/main_module::$tpl_name
Sorry, I don't know what's happening there. It could be something went wrong in your update process.
Did you try
  • Purging the cache?
  • Disabling and enabling?
  • Disabling, deleting data (backup store/customcode if you want to keep edits), enable ?
  • Disabling other extensions?
Before uploading, did you disable a previous version of the extension?
What is the url? (No domain needed, only the query parameters.)
User avatar
Walther
Registered User
Posts: 298
Joined: Fri Jul 09, 2004 5:21 pm
Location: The Netherlands

Re: [RC] Custom Code

Post by Walther »

PayBas wrote:Gotta give props for this original idea.
Started with a question to insert Piwik Analytics like the Google Analytics extension, and soon the idea was reformatted in inject custom code in to header and footer extension request.
Martti picked these idea's up and the result is this very powerful extension, which was not foreseen in the first place :lol:

Very nice work.
trebla
Registered User
Posts: 8
Joined: Sat Feb 15, 2003 9:10 pm
Contact:

Re: [RC] Custom Code

Post by trebla »

Great extension for the ones mastering the code.
I understand with help of it I would be able to add the OpenX banner to my forum header, without a need to modify files for each individual style used. On phpbb2 and phpbb3.0.x I have done it by editing directly the overall_header.html and "forcefully" adding a table with two cells, one containing the site logo and the other containing the banner. Search box has been pushed a bit down and is situated below the table.

Code: Select all

<div id="wrap">
	<a id="top" name="top" accesskey="t"></a>
	<div id="page-header">
		<div class="headerbar">
			<div class="inner"><span class="corners-top"><span></span></span>

                       <table width="100%" border='0' cellspacing="15" cellpadding="0">
                <tr>
                        <td><a href="{U_INDEX}">{SITE_LOGO_IMG}</a></td>
                        <!--<td width="100%" align="center"><h1>{SITENAME}</h1><span class="gen">{SITE_DESCRIPTION}</span></td> -->
                        <td width="100%" align="center"><a href='http://myopenxserver.com/openx/www/delivery/ck.php?n=acc51c76&cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://myopenxserver.com/openx/www/delivery/avw.php?zoneid=3&cb=INSERT_RANDOM_NUMBER_HERE&n=acc51c76' border='0' alt='' /></a></td>
                </tr>
                </table>
Current 3.0.x version of the forum is at http://velo.clubbers.ee/foorum/index.php

I have tried to figure out the way getting same result with this extension but I clearly admit I lack the knowledge of modern HTML for it.

I clearly do not want to be abusive, but could anyone offer me proper lines of code and name of file to contain that code. This would open me the way to upgrade my forum to 3.1.x.
Locked

Return to “Abandoned Extensions”