26

Re: [Mod] Style - Login Box on Frontpage

You don't need to change the template, just output your code.

27

Re: [Mod] Style - Login Box on Frontpage

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??

28

Re: [Mod] Style - Login Box on Frontpage

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>

29

Re: [Mod] Style - Login Box on Frontpage

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.

30

Re: [Mod] Style - Login Box on Frontpage

KeyDog wrote:

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.

31

Re: [Mod] Style - Login Box on Frontpage

I'd just forget about the template and output the code wherever I want.

32 (edited by KeyDog 2009-01-29 00:20)

Re: [Mod] Style - Login Box on Frontpage

But you'd put user_avatars.php in extension right?

MattF wrote:

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.

33

Re: [Mod] Style - Login Box on Frontpage

I'd put its code in the extension, yes.

34

Re: [Mod] Style - Login Box on Frontpage

Garciat wrote:

I'd put its code in the extension, yes.

btw: seeing as you could probably do this in 2min smile 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! big_smile I'd be lost without your quick feedbacks

35

Re: [Mod] Style - Login Box on Frontpage

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.

36

Re: [Mod] Style - Login Box on Frontpage

ok cheers smile

37

Re: [Mod] Style - Login Box on Frontpage

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>

38

Re: [Mod] Style - Login Box on Frontpage

        <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.

39

Re: [Mod] Style - Login Box on Frontpage

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....

40

Re: [Mod] Style - Login Box on Frontpage

str_replace('<!-- forum_crumbs_top -->', $login_form."\n<!-- forum_crumbs_top -->", $tpl_main);

and yes, add a slash to login.php.

41

Re: [Mod] Style - Login Box on Frontpage

http://rapidshare.com/files/191135512/l … ntpage.zip (the extension as discussed - in case u wanna try)

nope... nothing showing on frontpage

....

42

Re: [Mod] Style - Login Box on Frontpage

http://home.garciat.org/code/login_frontpage.zip

43

Re: [Mod] Style - Login Box on Frontpage

http://keydogbb.info/img/login_frontpage.gif

44

Re: [Mod] Style - Login Box on Frontpage

Something wrong?

45

Re: [Mod] Style - Login Box on Frontpage

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?

46

Re: [Mod] Style - Login Box on Frontpage

A slash '/' is missing: '../extensions/login_frontpage/login.php'

47

Re: [Mod] Style - Login Box on Frontpage

yeah big_smile 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...

48

Re: [Mod] Style - Login Box on Frontpage

Edit your hooks cache to fix the error then uninstall.

49

Re: [Mod] Style - Login Box on Frontpage

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];

50 (edited by AndersB 2009-03-18 09:32)

Re: [Mod] Style - Login Box on Frontpage

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?