Re: [Mod] Style - Login Box on Frontpage
You don't need to change the template, just output your code.
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.3 discussion → [Mod] Style - Login Box on Frontpage
You don't need to change the template, just output your code.
Let's take an example:
Your user_avatars that goes in include/user/user_avatars.php
and requires change to main.tpl
Would it be possible to put user_avatars.php and also a new main.tpl in an extension - do some stuff like in Reines post in manifest.xml
and like that have a one click install solution??
OK, if you wanna do it your way, you can copy the user_avatars.php file from the extension folder to the include/user/ folder and then just add the include comment.
<hook id="hd_template_loaded">
str_replace('<!-- forum_announcement -->', "<!-- forum_include \"user_avatars.php\" -->\n<!-- forum_announcement -->", $tpl_main);
</hook>
Just wondering:
a. Is it a bad idea to add a completely new main.tpl INSIDE the extension folder or BETTER?
b. Putting user_avatars.php INSIDE the extension (not include/user/) and running it from there is what I meant...
If I have to upload extension and a file it's technically not a pure extension anymore?
Thx.
Just wondering:
a. Is it a bad idea to add a completely new main.tpl INSIDE the extension folder or BETTER?
b. Putting user_avatars.php INSIDE the extension (not include/user/) and running it from there is what I meant...If I have to upload extension and a file it's technically not a pure extension anymore?
Thx.
It's merely a case of upgrading ease. Going outside of the extension system means you have to remember to make sure all of your code is updated, (if necessary), if the base system is updated/upgraded.
I'd just forget about the template and output the code wherever I want.
But you'd put user_avatars.php in extension right?
It's merely a case of upgrading ease. Going outside of the extension system means you have to remember to make sure all of your code is updated, (if necessary), if the base system is updated/upgraded.
Yeah that's why I prefer it all in extension itself.
I'd put its code in the extension, yes.
I'd put its code in the extension, yes.
btw: seeing as you could probably do this in 2min what holds you back? you don't mind giving "support" for how to do things - but don't want to make ext's anymore?
I feel stupid basically copying what I ask you, then slapping it in extension.
You shouldn't give up the ext making! I'd be lost without your quick feedbacks
I'm a bit tired at the moment (and hungry), so I'm gona see what I can do about that (a.k.a. I'm leaving the forums to eat something and go sleep).
So... maybe tomorrow.
ok cheers
garciat -
does this make sens for the login mod?
as an extension
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
<extension engine="1.0">
<id>login_frontpage</id>
<title>Login Box On Frontpage</title>
<version>1.0.0</version>
<description>Add The Login Boxes To Frontpage</description>
<author>PunBB Forum</author>
<minversion>1.3.2</minversion>
<maxtestedon>1.3.2</maxtestedon>
<hooks>
<hook id="vt_pre_header_load"><![CDATA[
require $ext_info['path'].'login.php';
]]></hook>
<hook id="hd_template_loaded">
str_replace('<!-- forum_announcement -->', "<!-- forum_include \"login.php\" -->\n<!-- forum_announcement -->", $tpl_main);
</hook>
</hooks>
</extension>
<hook id="hd_template_loaded">
ob_start();
require $ext_info['path'].'login.php';
$login_form = ob_get_contents();
ob_end_clean();
str_replace('<!-- forum_announcement -->', $login_form."\n<!-- forum_announcement -->", $tpl_main);
</hook>
and get rid of the other hook.
Also, remember the CDATA tags.
Question:
if I want it to appear like if I had done this in main.tpl :
<div id="brd-main">
<!-- forum_main_title -->
HERE
<!-- forum_crumbs_top -->
what does
str_replace line need to look like?
btw: why am I not just including login.php ? and instead using login form?
and also
require $ext_info['path'].'login.php';
caused a fatal error on my test board....
how do I rectify a fatal error?
it should be
require $ext_info['path'].'/login.php'; ? that's what I tried and it didn't show anything on my board, but installed fine....
str_replace('<!-- forum_crumbs_top -->', $login_form."\n<!-- forum_crumbs_top -->", $tpl_main);
and yes, add a slash to login.php.
http://rapidshare.com/files/191135512/l … ntpage.zip (the extension as discussed - in case u wanna try)
nope... nothing showing on frontpage
....
Something wrong?
oh just one thing on the first draft code you'd given me which caused
Fatal error: require() [function.require.php]: Failed opening required '../extensions/login_frontpagelogin.php'
how do I undo that? what do I delete?
A slash '/' is missing: '../extensions/login_frontpage/login.php'
yeah but i've uploaded the correct file to that forum but it still gives me the fatal error
once an extension is installed - you can't even get back in to admin to uninstall it
so my question is, is there another way - rather than admin interface - to delete it? (just deleting extension folder doesn't help I believe...
Edit your hooks cache to fix the error then uninstall.
yep that worked thanks.
deleted this
',
),
'hd_template_loaded' =>
array (
0 => '$ext_info_stack[] = array(
\'id\' => \'login_frontpage\',
\'path\' => FORUM_ROOT.\'extensions/login_frontpage\',
\'url\' => $GLOBALS[\'base_url\'].\'/extensions/login_frontpage\',
\'dependencies\' => array (
)
);
$ext_info = $ext_info_stack[count($ext_info_stack) - 1];
I have a similar problem.
I'd like to have a "log out"-link on the front page, and now I have code which looks like this:
<a href ="$baseurl.'forum/login.php?action=out&id='.$forum_user['id'].'
&csrf_token='.generate_form_token(forum_link($forum_url['login']))">Logga ut</a>
I'm pretty sure it's the generate_form_token() that is causing my headache, because I get the same errors as the topic started when I'm using this.
Isn't there any documentation for this function?
PunBB Forums → PunBB 1.3 discussion → [Mod] Style - Login Box on Frontpage
Powered by PunBB, supported by Informer Technologies, Inc.