Elxis CMS Forum

Support => Elxis 4.x/5.x DEV => Topic started by: Amigamerlin on October 22, 2012, 18:46:33

Title: ELXIS 4.0 Nautilus template system questions
Post by: Amigamerlin on October 22, 2012, 18:46:33
Hello Datahell
I've read somewhere that you were build a template compiler that let the joomla template to be loaded inside ELXIS 4.0 but after you removed this feature.
I would ask if is there any way to can "make" compatible joomla 1.7-2.5 template with ELXIS 4.0.
Maybe having a "compiler" like the one you wrote can be a good start to build quickly a large number of template for elxis 4.0.
Let me know.

Thank you
Title: Re: ELXIS 4.0 Nautilus template system questions
Post by: datahell on October 22, 2012, 20:09:50
I built the compiler but finally I removed it for Elxis source.
The reason is that the majority of users focus on complex templates with a lot of customization and PHP code, and for these the compiler wont do much. They will finally end with a template not 100% Elxis compatible. They will need advanced skills to fix the issues that will arise, and most users don't have such skills. For simple templates the compiler works good. But, as I said not for all templates. Also the templates are continuously change so you need continuously to also update the compiler. I preferred not to include something that will mostly create troubles than give solutions. So don't ask about it, I wont release it. Believe me it is better this way.

If you know some php and be a little smart you can easily convert the basic joomla code that can be found in a template into Elxis compatible...

For instance this:
<jdoc:include type="modules" name="xxx" />
Can be replaced for Elxis 4.x with this:
<?php $eDoc->modules('xxx'); ?>
This:
<jdoc:include type="component" />
With this:
<?php $eDoc->component(); ?>
This:
<jdoc:include type="head" />
with this (requires more changes in the head section):
<?php $eDoc->showHead(); ?>
This:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
With this:
<html<?php echo $eDoc->htmlAttributes(); ?>>
This:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
With this:
<?php echo $eDoc->getDocType(); ?>
etc...

I think this is an opportunity to write a few things about templates.
There is a "school" saying that templates should not contain PHP code (because the designers don't know php or for separating the logic from the interface). They should contain some weird template-engine-specific coding that will be converted into php code when the template gets parsed. My opinion is that this way you add a second processing layer that makes your script much slower. It is also not simpler for the users as you force them to learn a weird template language without any use. Decades of documentation pages for something that could be done with half a line of PHP code. So, I believe using simple and easy php coding that even monkeys can understand is the best option. And this is what Elxis 4.x does. And this is why templates parsing in Elxis is faster than Joomla.
Title: Where i'm wronging????
Post by: speck on October 30, 2012, 12:44:32
Getting a look a delta template, i'm starting to create a new template, but i have a lost of problem to call Jscript

in template the first part is:
Quote
defined('_ELXIS_') or die ('Direct access to this location is not allowed');

$eLang = eFactory::getLang();
$eDoc = eFactory::getDocument();
$elxis = eFactory::getElxis();

elxisloader::loadFile('templates/template1/includes/template1.class.php');
$template1 = new templateTemplate1();

echo $eDoc->getDocType()."\n";
?>

<html<?php echo $eDoc->htmlAttributes(); ?>>
<head>
   <?php $eDoc->showHead(); ?>
   <link rel="stylesheet" href="<?php echo $elxis->secureBase(); ?>/templates/template1/css/template<?php echo $eLang->getinfo('RTLSFX'); ?>.css" type="text/css" />
    <?php $template1->loadHeader(); ?>
</head>
to me it seems ok

the part call the jscript in template.class.php is this
Quote
    public function loadHeader() {

      $eDoc = eFactory::getDocument();
      $elxis = eFactory::getElxis();
       
       $eDoc->addJQuery();
       $eDoc->addScriptLink($this->url.'/includes/hoverIntent.js');
       $eDoc->addScriptLink($this->url.'/includes/superfish.js');
        
      $eDoc->addScript('jQuery(function(){ jQuery(\'.topmenu ul.elx_menu\').superfish(); });');
      $eDoc->addScript('jQuery(function(){ jQuery(\'.left ul.elx_vmenu\').superfish(); });');
      
      $js = '$(document).ready( function(){            
            $(\'.topmenu ul.elx_menu\').superfish({  delay:300,
                                          speed:500,
                                          autoArrows:1,
                                          dropShadows:1
            });
            $(\'.left ul.elx_vmenu'\).superfish({  delay:300,
                                          speed:500,
                                          autoArrows:1,
                                          dropShadows:1
            });
         });';

      $eDoc->addScript($js);

    }   
the result in html page is this
Quote
   <script type="text/javascript" src="http**//localhost/includes/js/jquery/jquery-1.7.1.min.js"></script>
   <script type="text/javascript" src="http**//localhost/includes/js/elxis.js"></script>
   <script type="text/javascript" src="http**//localhost/templates/template1/includes/hoverIntent.js"></script>
   <script type="text/javascript" src="http**//localhost/templates/template1/includes/superfish.js"></script>
  :-[ :-[ :-[
   <script type="text/javascript" src="http**//localhost/includes/js/jquery/jquery-1.7.1.min.js"></script>  :-[ :-[ :-[
   <script type="text/javascript" src="http**//localhost/includes/js/jquery/colorbox/colorbox.js"></script>
   <script type="text/javascript" src="http**//localhost/components/com_search/extra/addengine.js"></script>
   <script type="text/javascript">
the problem is
query-1.7.1.min.js called twice ???
gallery and menu works badly

if i get a look in delta template
Quote
<script type="text/javascript" src="http**//localhost/includes/js/jquery/jquery-1.7.1.min.js"></script>
   <script type="text/javascript" src="http**//localhost/modules/mod_eidynamicslidernews1/js/jquery.easing.js"></script>
   <script type="text/javascript" src="http**//localhost/includes/js/jquery/colorbox/colorbox.js"></script>
   <script type="text/javascript" src="http**//localhost/includes/js/elxis.js"></script>
   <script type="text/javascript" src="http**//localhost/templates/delta/includes/hoverIntent.js"></script>
   <script type="text/javascript" src="http**//localhost/templates/delta/includes/superfish.js"></script>

and this is right.
where is mi worng????? i'm become a lot crazy  ;D

in attchment the class file (attention is incomplete...before i want solve this tedious problem to start with parameters
Title: Re: ELXIS 4.0 Nautilus template system questions
Post by: datahell on October 30, 2012, 14:25:09
If you use the addjQuery method then you are sure that jquery will be loaded only once. I dont see any problem in the file you attached but without seeing index.php and the whole template I can't tell for sure.
BTW you have an error in escaping a single quote:
Wrong:
$(\'.topmenu ul.elx_menu'\)
Correct:
$(\'.topmenu ul.elx_menu\')
Title: Re: ELXIS 4.0 Nautilus template system questions
Post by: speck on October 30, 2012, 17:13:49
thanks.
i saw it, corrected by time, but not works  >:(
... in any case i solved insert directly in the head of template the two jscript and the js script code.  :)

about this.
compliments for your hard work ... create template is very easy.... more easy and quickly than old elxis  :o
guys forget joomla templates and similar .... new elxis is on another planet  :)

a good layout in css, few classes of css to customing, and template is ready,
Title: Re: ELXIS 4.0 Nautilus template system questions
Post by: Amigamerlin on October 31, 2012, 08:51:32
thanks.
i saw it, corrected by time, but not works  >:(
... in any case i solved insert directly in the head of template the two jscript and the js script code.  :)

about this.
compliments for your hard work ... create template is very easy.... more easy and quickly than old elxis  :o
guys forget joomla templates and similar .... new elxis is on another planet  :)

a good layout in css, few classes of css to customing, and template is ready,

Great ... now I know who ask for template  ;D ;D ;D