Not logged in. · Lost password · Register
Forum: Customising UNB Modifications and plug-ins RSS
custompage plugin
How does it work?
Page:  1  2  next 
blakeyrat #1
Member since Feb 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Subject: custompage plugin
I've installed the custompage plugin, but I have no clue how it works, how to set its options, or even exactly what it does.  :)  (I thought it might be used to customize the appearance of forum pages.)  I can't find any documentation about it.  Can anybody shed some light please?
Avatar
Einstein #2
Member since Dec 2005 · 68 posts · Location: Turku, Finland
Group memberships: Members
Show profile · Link to this post
It's an "template" how you can code your own custompage into UNB. You need to code the plug-in according to your needs.
Info Page plug-in | My business | My forum
Avatar
Yves (Administrator) #3
User title: UNB developer & webmaster
Member since Jan 2004 · 3855 posts · Location: Erlangen, Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #1
Just read the source code, there's a whole lot of comments in there explaining what you can do there.

custompage is a plug-in that requires you to code PHP and HTML to get your very custom page running. You probably don't want to use it otherwise.
♪ ...nanananah, all in all we’re just brilliant thieves, nanananah... ♪♬
blakeyrat #4
Member since Feb 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Ah, that clears that up.
Avatar
Keith #5
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Subject: Custompage CSS file
I have found the following in the php code:

// Include CSS stylesheet
UnbRequireCss('custompage');

But I don't know where I would put the CSS stylesheet and what to name it.
What should the name of the stylesheet be for the custompage?
Where should that stylesheet be located?
Avatar
Yves (Administrator) #6
User title: UNB developer & webmaster
Member since Jan 2004 · 3855 posts · Location: Erlangen, Germany
Group memberships: Administrators, Members
Show profile · Link to this post
All CSS goes to where the other CSS already is. Note that you need a spearate copy for each design you've got installed. And the name is exactly that string: "custompage". Comparing it to the other CSS files, the filename is then "custompage.css.php".
♪ ...nanananah, all in all we’re just brilliant thieves, nanananah... ♪♬
Avatar
Keith #7
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
In reply to post #5
Subject: Custompage icon
Is there a way to set the icon displayed in the head_navigation tab for the Custompage?
Currently, it displays no icon. I'm not good at creating graphics, so I'm just going to use the bookmark.png.

Another question: Does this plugin allow for more than one custom page?

Oh, one more question: Is it possible, or are there any plans to include a user settings panel for the custompage? I am thinking I would like my users to be able to set their preferences for the custompage under Settings->User Settings. I am creating an interactive custompage.

 :-)
Avatar
Keith #8
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
In reply to post #6
OK, thank you.
I will create a custompage.css.php file and I will put it in unb_lib/designs/modern/css/

Thank you.
Avatar
Yves (Administrator) #9
User title: UNB developer & webmaster
Member since Jan 2004 · 3855 posts · Location: Erlangen, Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #7
Open common_out.lib.php and see where the page.navigation.postlinks hook is called. The standard links are added in the same structure, there's one array item 'image' you can use for that.

One page per plug-in. The custompage plugin is only a demo, you should rename it for your implementation.

There's a different plugin for a custom settings category. Hm, okay, no demo plugin. See the ACLeditor or Logveiwer plugins for how to add and handle a settings category.
♪ ...nanananah, all in all we’re just brilliant thieves, nanananah... ♪♬
Avatar
Keith #10
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Oh, I see. I should change the name of the files where it says 'custompage' and then I can have as many custompages as I want. Although I probably wouldn't have more than 3, but just working on ONE for now.

So, does every file dropped into the plugins folder automatically get included by the unb system?

Oh, now I see what it says in custompage.php. It says this:

// This is a demo plug-in. It shows how custom pages can be added to the board
// at the example of a "custompage". If you want to use it to add your own page,
// you should make a copy of this plug-in, name it by your new page and update
// everything like "custompage" in it to the new page name, i.e. "downloadpage"
// or "imprintpage". You can also modify the plug-in so that it adds more than
// one page at a time. For more information on the hook function parameters
// refer to the online documentation:
// http://newsboard.unclassified.de/devel/docs/plugins#hooks


Thanks again. My custompage is turning out nicely, all thanks to you!  :-D
Avatar
Yves (Administrator) #11
User title: UNB developer & webmaster
Member since Jan 2004 · 3855 posts · Location: Erlangen, Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by Keith:
So, does every file dropped into the plugins folder automatically get included by the unb system?

Yes, unless you disable it from the plugin settings page in your Admin settings. (Which can only be done when the plugin has been found already.)
♪ ...nanananah, all in all we’re just brilliant thieves, nanananah... ♪♬
Avatar
Keith #12
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Subject: How to add icon to Custompage navigation link
I have successfully added an icon to the custompage navigation link.
There is a note in the custompage.php file but no example.
I will just put an example here for others who might need it.
In the following function, there are two lines you a can add.
image and imageUrl, although it seems that the nav bar only uses imageUrl.

function UnbHookCustomPageAddNavLink(&$data)
{
    global $UNB, $UNB_T;

    $mylink = array(
        'link' => UnbLink('@custompage', null, true),
        'image' => '<img ' . $UNB['Image']['imagename'] . ' />',
        'imageUrl' => 'imagename.png',

        'title' => $UNB_T['_custompage.linktitle'],
        'active' => $UNB['ThisPage'] == '@custompage');

    // You can use the array items 'image' and 'imageUrl' to set an icon before
    // the navigation link. See the UnbBeginHTML function for more details.
    // This image must currently reside in the design's img/ directory.

    // Add new link at the end of the links array
    $data[] = $mylink;

    // If you want to add your link to the left of the navigation line, you
    // must add it to the beginning of the links array. This can be done like
    // the following example: (instead of the line above!)
    // $data = array_merge(array($mylink), $data);

    return true;
}
Avatar
Keith #13
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Subject: Control Panel Category
And here is the code to add a new control panel category to the menu in Settings.
Although, one more hook is needed for the panel contents. I haven't done that one yet.
That is essentially a form. But I have question about updating the database.
Should I create my own tables in the database to store each user's settings for my custom page?
And write my own sql and take care of it all on my own?
Or is there another recommended method?
I really have to study UNB's forms processing to make sure my new form behaves correctly.

// Hook function to add a new control panel category
//

function UnbHookCustomPageAddCPCategory(&$data)
{
   
        $data[] = array(
            'title' => '_custompage.cpcategory',
            'link' => UnbLink('@cp', 'cat=custompage', true),
            'cpcat' => 'custompage');

    return true;
}

// Register hook functions
UnbRegisterHook('cp.addcategory', 'UnbHookCustomPageAddCPCategory');
gnauck #14
Member since Feb 2006 · 33 posts
Group memberships: Members
Show profile · Link to this post
I am just working on custom pages. But I have poblems with the UnbRequireCss function.

in the custompage.inc.php template I removed the comment for the custom css and names it foo.

UnbRequireCss('foo');

I tried to place a foo.css.php or only foo in:
unb_lib/designs/modern/css
unb_lib/plugins/

But it does not load my css, and I see nothing in the header referencing it.

Any idea what I am doing wrong? or did the API change and I use wrong templates?

Thanks.
Alex
Avatar
Yves (Administrator) #15
User title: UNB developer & webmaster
Member since Jan 2004 · 3855 posts · Location: Erlangen, Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Did you read this? http://newsboard.unclassified.de/coderef/function_unbrequi…

If you mean to call the PHP function directly, are you sure it is actually called? Where did you put it?
♪ ...nanananah, all in all we’re just brilliant thieves, nanananah... ♪♬
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  1  2  next 
Go to forum
This board is powered by the Unclassified NewsBoard software, 20120620-dev, © 2003-2011 by Yves Goergen
Page created in 226 ms (167.6 ms) · 141 database queries in 123.9 ms
Current time: 2013-05-25, 20:34:58 (UTC +02:00)