CMS - How To Create New HTML Block To Add In Your CMS »  Show posts from    to     

Icy Phoenix


Documentation And How To - CMS - How To Create New HTML Block To Add In Your CMS



hpl [ Wed 11 Apr, 2007 18:25 ]
Post subject: CMS - How To Create New HTML Block To Add In Your CMS
Introduction
With the CMS system you can add each kind of block in every page of your Icy Phoenix board. If, for example, you have a particular block that you must put in a lot of personal page (like a footer or sponsor), is very useful to create a custom block in a block file, because you can edit .tpl file only one time and upload it: all your pages will then get the changes!


Instructions
  1. Create yoursite/blocks/blocks_imp_YOURBLOCK.php

    Code: [Hide]
    1. <?php  
    2. /***************************************************************************  
    3. * blocks_imp_YOURBLOCK.php  
    4. * -------------------  
    5. * begin : 2007/02/06  
    6. * copyright : Mighty Gorgon  
    7. * website : http://www.mightygorgon.com  
    8. * email : mightygorgon@mightygorgon.com  
    9. *  
    10. ***************************************************************************/  
    11.  
    12. /***************************************************************************  
    13. *  
    14. * This program is free software; you can redistribute it and/or modify  
    15. * it under the terms of the GNU General Public License as published by  
    16. * the Free Software Foundation; either version 2 of the License, or  
    17. * (at your option) any later version.  
    18. *  
    19. ***************************************************************************/  
    20.  
    21. if ( !defined('IN_PHPBB') )  
    22. {  
    23. die('Hacking attempt');  
    24. }  
    25. if(!function_exists(imp_YOURBLOCK_func))  
    26. {  
    27. function imp_YOURBLOCK_func()  
    28. {  
    29. global $lang, $template, $board_config;  
    30.  
    31. $template->assign_vars(array(  
    32. )  
    33. );  
    34. }  
    35. }  
    36.  
    37. imp_YOURBLOCK_func();  
    38.  
    39. ?> 


  2. Create yoursite/templates/xxx/blocks/YOURBLOCK_block.tpl and put in it your personal HTML code.

  3. P.S.: replace YOURBLOCK with your personal name! That's all, good work!


hpl [ Wed 11 Apr, 2007 18:27 ]
Post subject: Re: How To Create New HTML Block To Add In Your CMS
I try to search there but there isn't this doc, I'm right?....

If for you is ok, I can put on public forum!


Mighty Gorgon [ Thu 12 Apr, 2007 01:10 ]
Post subject: Re: How To Create New HTML Block To Add In Your CMS
Thanks hpl, this tutorial is useful as well as the other you have created .

When you have some free time, can you also show how to include some text in a lang file and then how to show it in this block?

Thank you very much.


Vortex [ Wed 01 Oct, 2008 00:10 ]
Post subject: Re: How To Create New HTML Block To Add In Your CMS
Ok, I tried in many ways but I didn't manage to see my variable recalled in the template


I am creating a block for my java chat. I am not using the simple html in CMS because I want the login of the chat to recall the username.

Here are my files:


root/blocks/blocks_imp_kopechat.php

Code: [Hide] [Select]
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
}
if(!function_exists(imp_kopechat_func))
{
function imp_kopechat_func()
{
global $userdata, $template, $board_config, $lang, $db, $phpEx;

$template->assign_vars(array(
'CHAT_USERNAME' => $username
)
);
}
}

imp_kopechat_func();

?>



and here's the template file:


root/templates/TEMPLATE/blocks/kopechat_block.tpl


Code: [Hide] [Select]
...java applet html code...

<param name="name" value="{CHAT_USERNAME}">

...java applet html code...




But it doesn't work. I tried with an echo, to see what happens and it seems to be an empty variable... the error must be in the .php file. I think it is just a stupid thing, it's just that I don't know phpBB enough

How do I recall the plain username of a user? (avoiding the colorizing function).


Thanks for your help.


hpl [ Wed 01 Oct, 2008 15:56 ]
Post subject: Re: How To Create New HTML Block To Add In Your CMS
FIND
Code: [Hide] [Select]
$template->assign_vars(array(
'CHAT_USERNAME' => $username
)
);


REPLACE WITH
Code: [Hide] [Select]
$template->assign_vars(array(
'CHAT_USERNAME' => $userdata['username']
)
);


Vortex [ Wed 01 Oct, 2008 16:22 ]
Post subject: Re: How To Create New HTML Block To Add In Your CMS
Damn I was sure I did try that! Anyway, now it works.

Thanks for your precious help, hpl.


gearhead [ Thu 02 Oct, 2008 04:19 ]
Post subject: Re: How To Create New HTML Block To Add In Your CMS
Many thanks to HPL, I really appreciate the topic.

IP rules!!!



sunbloquer [ Tue 20 Jan, 2009 15:32 ]
Post subject: Re: How To Create New HTML Block To Add In Your CMS
Hello, I tried the block and works, but is not necessary to include the code, which should show this is

Link

but it just shows me the pictures, I guess not include the php code ...... someone could tell me if possible?

Code: [Hide] [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<link rel="stylesheet" href="wg_images/wgstyle.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>WINDGURU PRO - MARDECANARIAS</title>
</head>

<body>
<div align="center"><img src="http://www.mardecanarias.com/windguru/wind_mar.png" longdesc="windguru_mardecanarias" />
<?php
require_once('windguru.inc.php'); // this will load the necessary classes
windguru_forecast(169675,'5212a649cd','es'); // Arucas
windguru_forecast(170133,'49767b3ce6','es'); // Agaete
windguru_forecast(170134,'448f82ac54','es'); // Melenara
?>

</div>
</body>
</html>


Thanks




Powered by Icy Phoenix