Page 1 of 1
Beginner here...
Posted: Tue Oct 24, 2006 5:50 pm
by Chandler Mike
I am just learning how to use Serendipity, and am trying to get our look and feel down.
I renamed the MT3-Squash template to my own name, and uploaded it so I can work on my own style.
Problem is, from reading the help, there should be a layout.php in there, but I don't see one. The newspaper template has one, but copying THAT file into my style affects nothing.
I basically just need a few quick tips on how to go about editing the layout of the page...I am not sure what file(s) to begin editing. I have changed some colors and fonts via the .css file, but I want to do some more things.
Thanks for your help!
Re: Beginner here...
Posted: Tue Oct 24, 2006 6:29 pm
by yellowled
Chandler Mike wrote:I basically just need a few quick tips on how to go about editing the layout of the page...I am not sure what file(s) to begin editing. I have changed some colors and fonts via the .css file, but I want to do some more things.
So you're looking for documentation. Hm. Where might that be located?
Technical Documentation on the s9y website might be a good point to start
I'm not too familiar with the MT templates (and unfortunately I don't have the time to have a look at them at the moment), so I can't give any precise hints, but you'll probably want to have a look at the docs on Smarty (that's the template engine s9y uses). Editing the index.tpl and/or entries.tpl are usually the first steps towards a new theme.
Please feel free to ask further questions here, we're always happy to help (if we have some spare time, that is

).
Re: Beginner here...
Posted: Tue Oct 24, 2006 6:36 pm
by yellowled
YellowLed wrote:I'm not too familiar with the MT templates (and unfortunately I don't have the time to have a look at them at the moment)
Ah, what the hell, what's another 5 minutes if you're already late, right?
So I just had a look at the MT Squash template ... hm, that's not much in that template dir. Basically, it's just the info file, a preview image and the style.css, which means that this template falls back to the default theme, which means it uses the .tpl files from the default template's directory.
So, depending on what you actually want to change, you should copy the necessary .tpl files from the default dir to your new template's dir and edit them to suit your needs. Which of course means that you should read something about Smarty templates, unless you already know Smarty
Hope that helped.
Re: Beginner here...
Posted: Tue Oct 24, 2006 6:42 pm
by Chandler Mike
YellowLed wrote:YellowLed wrote:I'm not too familiar with the MT templates (and unfortunately I don't have the time to have a look at them at the moment)
Ah, what the hell, what's another 5 minutes if you're already late, right?
So I just had a look at the MT Squash template ... hm, that's not much in that template dir. Basically, it's just the info file, a preview image and the style.css, which means that this template falls back to the default theme, which means it uses the .tpl files from the default template's directory.
So, depending on what you actually want to change, you should copy the necessary .tpl files from the default dir to your new template's dir and edit them to suit your needs. Which of course means that you should read something about Smarty templates, unless you already know Smarty
Hope that helped.
Yeah, it did help...I've been messing with the index.tpl template and changing some things to look right.
One question for you. I want to toss some php code in there, but it's obviously not going to run correctly in the .tpl file.
How do you go about doing that?
And I also never had a layout.php in my default template.
Posted: Tue Oct 24, 2006 10:33 pm
by Chandler Mike
Okay, I think I've gotten somewhere, but am needing some help.
I don't precisely understand how to register a function from the config.inc.php file to return a variable I can use in my index.tpl file.
My config file looks like this:
<?PHP
$serendipity['smarty']->register_function('random_image');
function random_image() {
$random = mt_rand(1, 13);
return $random;
}
?>
And I don't know how to access that from the TPL file.
Any ideas anyone?
Posted: Tue Oct 24, 2006 10:42 pm
by garvinhicking
Hi Mike!
If you got that PHP code, you can use this in your smarty .tpl file:
However, your PHP function call must be like this:
Code: Select all
<?PHP
$serendipity['smarty']->register_function('random_image');
function random_image($params, &$smarty) {
$random = mt_rand(1, 13);
return $random;
}
Every function available in Smarty as a FUNCTION (not a modifier!) needs to use $params and $smarty in the function parameters.
Have a look at the smarty.php.net documentation about register_function to see some more examples.
HTH,
Garvin
Posted: Tue Oct 24, 2006 10:52 pm
by Chandler Mike
garvinhicking wrote:Hi Mike!
If you got that PHP code, you can use this in your smarty .tpl file:
However, your PHP function call must be like this:
Code: Select all
<?PHP
$serendipity['smarty']->register_function('random_image');
function random_image($params, &$smarty) {
$random = mt_rand(1, 13);
return $random;
}
Every function available in Smarty as a FUNCTION (not a modifier!) needs to use $params and $smarty in the function parameters.
Have a look at the smarty.php.net documentation about register_function to see some more examples.
HTH,
Garvin[/quote]
THANKS!
Actually didn't work until I added the extra code in the register_function area:
[code]
<?PHP
$serendipity['smarty']->register_function('random_image', 'random_image');
function random_image($params, &$smarty) {
$random = mt_rand(1, 13);
return $random;
}
But it's working now, thank you so much!