1
Dhurgan
using templates in admin
  • 2004/4/26 15:09

  • Dhurgan

  • Just popping in

  • Posts: 68

  • Since: 2004/2/11


I tried to find an module admin section that used templates, but those seems hard to find.

Any special reason for that?

Learning a lot about XOOPS kernel and classes lately...

2
Anonymous
Re: using templates in admin
  • 2004/4/26 15:17

  • Anonymous

  • Posts: 0

  • Since:


Quote:
Any special reason for that?


Lazy coders? LOL

Here is a short snippet if you want to make admin templates:

//function for displaying xplayer administration
function xplayeradmin()
  {
//xoops_cp_header(); this could be at another place in the admin code
    
require_once XOOPS_ROOT_PATH.'/class/template.php';
    if ( !isset(
$xoopsTpl) )
  { 
    
$xoopsTpl = new XoopsTpl();
  }
    global 
$xoopsDB$genrelist$xoopsModule;
    
$sql 'SELECT genre FROM '.$xoopsDB->prefix('xplayer_files').' GROUP BY genre';
    
$result $xoopsDB->query($sql);
    while (list(
$genrelist) = $xoopsDB->fetchRow($result))
  {
    
$xoopsTpl->append('genrelist'$genrelist);
  }
    
    
$xoopsTpl->display'db:xplayer_amxplayer.html' );  
  }
//------------------------------------------

3
Dhurgan
Re: using templates in admin
  • 2004/4/26 15:28

  • Dhurgan

  • Just popping in

  • Posts: 68

  • Since: 2004/2/11


guessed as much...

*sigh* they state HOW to code and the exact number of spaces to use while indenting (not that many modules follows it ) and its in the doc that you should use templates and naming conventions...

sadly not many examples of code shot it being used and the documentation basically isnt existing.

Anyone that can recommend a module that does this nicely?
I am trying to code to their standards...

4
fatman
Re: using templates in admin
  • 2004/4/26 22:56

  • fatman

  • Friend of XOOPS

  • Posts: 176

  • Since: 2003/12/13


There have been a few threads discussing this. I have used Smarty Templates for admin pages in the latest beta release of the NoAh module. You can take a look at this module for an example. (http://dev.xoops.org/modules/xfmod/project/?xdb )

There has been a lot of discussion and effort by module builders over the last couple of months to nail down basic documentation for module development standards. Likely dev.xoops wiki is the best place to find these contributions.

5
Dhurgan
Re: using templates in admin
  • 2004/4/28 6:26

  • Dhurgan

  • Just popping in

  • Posts: 68

  • Since: 2004/2/11


Thanks for that link, I will look there.

I've looked at the latest documentation here, the visual introduction, it sure is a helpful documentation to use XOOPS "as is" after an installation.

I will look at the dev.xoops wiki, if its the same as here its not much, but if theres more there...

I dont mind to wade through sourcecode to find out things, but I dont think I should have to, it timeconsuming and means I have to figure out what goes where in calls and why instead of getting an API to follow. I resent having to spend the little time I have researching how others coded the stuff I'm supposed to use when they, who did the code, could easliy have documented it in the first place and made their intentions clear.

For an easy example, the XoopsForm* functions... all thats available is the "huge" png really, and lots of code to wade through... I more or less made my own documentation to be able to use it, same goes for all the object calls of the user object.

For a good example on HOW i could be done, the very simple documentation that smarty itself comes with is more then enough to make coding it very simple.

Maybe dev.xoops has something...

6
Mithrandir
Re: using templates in admin

On the dev.xoops.org wiki, we are in the process of building up some guidelines on among other things, the XoopsForm classes.

Smarty in (system) admin is not per standard in XOOPS because if an error is made in the Smarty code for the admin section (a template, perhaps) there is no way to get to the template admin to correct the mistake.

7
Dhurgan
Re: using templates in admin
  • 2004/4/28 8:17

  • Dhurgan

  • Just popping in

  • Posts: 68

  • Since: 2004/2/11


Yes, the dev.xoops.org docs are much better, although they could use a pretty print button

Concerning errors in the templates, you could use the db engine to fix that, i.e. phpMyAdmin and go directly to the problem. Although I do see your point.

Not that core admin code need to use the templates then, but add on modules sure could.


8
Herko
Re: using templates in admin
  • 2004/4/28 9:08

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Another way to ensure that the admin section keeps working when there is a template error in the admin is to have a non-changable default admin template set that can be easily reverted to (kinda like the default template set for the front end). Then, with a Big Red Button, you can restore the default admin templates, so you can access the admin again.

This is on the to-do list for XOOPS 2.2, by the way.

Herko

Login

Who's Online

203 user(s) are online (134 user(s) are browsing Support Forums)


Members: 0


Guests: 203


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits