I'm very new to drupal, and I'm studying it.
I'm trying to port bluemarine from phptemplate to smarty engine. Unfortunately I can't see any smarty theme ready for drupal 6 so I have no example to refer to and the updated documentation seems to be the README.txt file included in the smarty-engine package.
I assume that throught smarty.engine all the common theme functions for drupal are ported to the smarty environment.
Right now the porting it's pretty good and easy. Infact all the work in the .tpl file seems to be to rewrite in a proper smarty-way the output of variables.
But (there is always a "but" :-D) a problem comes out with primary and secondary links
This code prints the primary links in bluemarine
<?php if (isset($primary_links)) { ?
<?php print theme('links', $primary_links, array('class' => 'links', 'id' => 'navlist')) ?>
<?php } ?>
I did this (a stupid way I know)
{php} if (isset($primary_links))
print theme('links', $primary_links, array('class' => 'links', 'id' => 'navlist'));
{/php}
I think it should work but nothing happens. Why?
Another question related:
I saw in the smarty.engine file the function
function smarty_theme($existing, $type, $theme, $path)
I found the same function in phptemplate.engine
I think that this function should overwrite the hook_theme function. Is it true?
I think that this fun
Thanks in advance to anyone would help me
--
enjoy
Dam
Comments
this code of course
this code of course works.
But I don't think it's the better way.
I'm curious to know if I can access the theme link function in the same way it happens for the phptemplate engine.
this is getting me mad. I
this is getting me mad.
I did another test:
$primary_links is a 3 depth array
I added these rows in page.tpl
and this in theme.inc
the result is:
but using this in the same page.tpl
I can see the primary_links properly (4 elements)
It seems that the variable primary_links get empty somewhere .. can't really understand this
getting closer
I read this row in the README.txt
The way Smarty plugins/'wrapper' functions work has changed. Create a function
mytheme__register_smarty_functions in your theme's template.php which returns an array
like the array $plugins in function &_smarty_get_object
Probably it's what I'm searching for but it's really too poor to be understood. Now I really need a help. I have no more resources :-(
also if I seem completely
also if I seem completely crazy due to the fact that I'm speaking alone ...
I read this in theme.inc
This doesn't happen in smarty!
I tried overriding in template.php .. nothing ... a function smarty_links would not be read
Even smarty_theme inside smarty.engine is never read
if I put an echo inside smarty_theme but is never output. this means is never parsed. why? it should be done automatically by drupal when a template is using smarty engine. right?
Sorry, this is not well
Sorry, this is not well documented. I have tried to take over the Smarty documentation but do not have access yet :(
To use Drupal's links which are simply an unordered list formatted with CSS, use the following functions in Smarty:
{theme_links links=$primary_links id='navlist'}
{theme_links links=$secondary_links id='subnavlist'}
A more smarty-like way of doing this would be to just get an array of links and do the HTML generation in the template: I have this working on my server but it is not in CVS (yet).
That's what I have in my
That's what I have in my theme and it works in Dupal 5, but in Drupal 6 I get this error
user error: Smarty error: [in themes/greypop_smarty/page.tpl line 31]: syntax error: unrecognized tag 'theme_links' (Smarty_Compiler.class.php, line 590) in C:\Users\Stephen\workspace\lvthunder\webroot\themes\engines\smarty\libs\smarty.class.php on line 1092.
user error: Smarty error: [in themes/greypop_smarty/page.tpl line 34]: syntax error: unrecognized tag 'theme_links' (Smarty_Compiler.class.php, line 590) in C:\Users\Stephen\workspace\lvthunder\webroot\themes\engines\smarty\libs\smarty.class.php on line 1092.
Also my sidebar isn't showing up in Drupal 6. This is the code I'm using.
Any ideas? Also are there any Drupal 6 themes that use smarty?
Try $left instead of
Try $left, instead of $sidebar_left. Unfortunately, there are no Smarty themes available for Drupal 6.x, yet...
That worked. Thanks
That worked. Thanks barretr. Now all I have to do is figure out the primary links problem.
It works
I have no idea if this is the proper way to do this or not but I think I got it working. I put an empty function.theme_links.php file in the plugins folder of the smarty theme engine then added the following code to smarty.engine at line 267
Hi there, I'm just about to
Hi there,
I'm just about to get started on a drupal 6 site for which I'd like to use smarty. I have spent a bit of time trying to track down a template so I don't have to start from scratch.
Would appreciate knowing where you are up to with this and if there's any chance I could have access to the code?
Cheers
Matt
Here's mine. I doubt it's a
Here's mine. I doubt it's a complete theme, but it works for me
http://www.lvthunder.com/greypop_smarty.zip