Page 1 of 1
Where can i edit the text for section headings/titles ?
Posted: Mon Feb 07, 2005 9:10 am
by PurpleCow
Hi,
I want to edit the section headings/titles...like which says Sticky Posting...i would like to change the text to In Focus and similarly other titles. how can i do the same.
Which file do i edit ? Looks like, i need to edit some php file.
Thanks for any help.
Cheers
Re: Where can i edit the text for section headings/titles ?
Posted: Mon Feb 07, 2005 2:53 pm
by garvinhicking
You can do that by editing the templates entries.tpl file. There it contains a text "STICKY_POSTINGS". You can change that to a hardcoded custom string, if you like.
The other way is to edit the serendlipty_lang_en.inc.php file and modify the constant there - but then of course you'd need to maintain your own language file...
So you will prefer the first way
Regards,
Garvin
Category Intros
Posted: Thu May 19, 2005 8:53 pm
by Jessi Miller
I have a similar question: To introduce each section, could I include a short paragraph in the serendipity_entryIcon span, inside entries.tpl? Or is there a better way to do that?
I'm pretty new to PHP, but I am fairly knowledgable with XHTML and CSS, in case that helps you make your answer.
Thanks very much, this forum is so informative!
PS - I was even considering placing a little random-quote rotation script with the category intro - would that be possible without a plugin?
Re: Category Intros
Posted: Fri May 20, 2005 11:37 am
by garvinhicking
I'm not really sure what you mean - in the line were it says "posted in FirstCategory" you want to add a text like "posted in FirstCategory (my life and ramblings)"?
This is possible either via plugins or Smarty templating, I'm just trying to figure out what exactly you mean
The same is with the quote rotation script - you'll either be able to do it via a smarty function, or via a Serendipity plugin; your choice
Using a smarty function would work like this:
1. Create a config.inc.php file inside your template directory
2. Create a function like this inside the PHP file:
Code: Select all
<?php
function myOwnQuote($params, &$smarty) {
$quotes = array('First Quote', 'Second Quote', 'Third Quote');
$quote = array_rand($quotes, 1);
return $quotes[$quote];
}
3. In that same file, register the just written function at the bottom of the file:
Code: Select all
$serendipity['smarty']->register_function('myOwnQuote', 'myOwnQuote');
4. Now you can use that small function in your template. Just edit your entries.tpl and at the place where you like a random quote, add this:
And you're done
HTH,
Garvin
Re: Category Intros
Posted: Fri May 20, 2005 5:34 pm
by Jessi Miller
garvinhicking wrote:I'm not really sure what you mean - in the line were it says "posted in FirstCategory" you want to add a text like "posted in FirstCategory (my life and ramblings)"?
Thanks, Garvin, for that great response! I'll definitely play around with the random quotes in the way you explained.
Here's a little mockup of what I'm looking to do on each category page:

In this example, we're looking at
http://www.litique.com/works/categories/3-Poetry/, and the red outline is where I'd like to be able to place custom, static text. There would be different text in that space in each other category, and it would stay at the top of the page permanently.
We're creating a literary critique system, and the editor wants to introduce each category page a little with what he's looking for.
Here's an idea - Is there a way to display the category's description? When you create a new category, as you know, it asks for a description, and I haven't seen a time when that displays, other than when you're in the admin, looking at the list of categories.
Thanks again for your help!
Re: Category Intros
Posted: Sun May 22, 2005 5:45 pm
by garvinhicking
Ah, okay - now I understand!
Yes, the is possible by tuning your Smarty Template. I'm a bit short on time, I will post a detailed example sometime tomorrow.
Best regards,
Garvin
Re: Category Intros
Posted: Sun May 22, 2005 6:11 pm
by garvinhicking
Okay, I propose you do this:
1. Create a new directory "templates/litique"
2. Copy the file "info.txt", "content.tpl" and "style.css" from the template which you are now using; if any of those files does not exist use the one from "templates/default"
3. Edit the file "info.txt" and insert the name of how you would like to call your new template (like "Litique")
4. Create a file "config.inc.php" inside your template/litique directory. Insert this code:
Code: Select all
<?php
if (is_numeric($serendipity['GET']['category'])) {
$serendipty['smarty']->assign('Category', serendipity_fetchCategoryInfo($serendipity['GET']['category']));
}
?>
5. Edit the file content.tpl. At the top of the file insert this:
Code: Select all
{if $Category.category_description}
<div>{$Category.category_description}</div>
{/if}
Now you're ready and set. The config.inc.php file part is responsible for assigning the currently selected category information into your Template. In the file content.tpl you use that assigned category information and emit it - only of course if a category is selected.
I have not tested this, but it should work fairly well. If you face any issues, please report back!
Regards,
Garvin
Something's not quite right.
Posted: Fri Jun 03, 2005 5:56 pm
by Jessi Miller
Sorry it's taken me so long to respond. I'm pretty sure it's something to do with the config.inc.php file, because when it is present in /templates/litique, nothing generates. It's just a blank page. As soon as I rename the file, everything comes back, but there aren't any category descriptions, of course.
I double-checked and yes, we do have category descriptions filled in. They're just text, too, no html or other weirdness.
I don't know much about programming, but could we create a little array? I looked up
Associative Arrays on smarty.php.net, and I understand how that works, but I need a little help with figuring out how to know what category is currently being displayed.
Maybe I'm on the wrong track with the array...
TIA
Re: Something's not quite right.
Posted: Tue Jun 07, 2005 12:45 pm
by garvinhicking
Can you post the full contents of your "config.inc.php" file? Can you try if the file has any parse errors? Check if your php display_errors is set to on.
You can also use "php -l config.inc.php" on the commandline to parse that file. I am quite sure that there is just a simple mistake...
Regards,
Garvin
Posted: Tue Jun 07, 2005 4:09 pm
by Jessi Miller
Hi Garvin,
I copied and pasted what you typed into the config.inc.php file, so no typos, and after I read your last post, I got some help from a programmer friend, who gave me the top two lines:
Code: Select all
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
if (is_numeric($serendipity['GET']['category'])) {
$serendipty['smarty']->assign('Category', serendipity_fetchCategoryInfo($serendipity['GET']['category']));
}
?>
The error message that displays is:
Fatal error: Call to a member function on a non-object in /var/sites/litique.com/htdocs/works/templates/litique2/config.inc.php on line 6
My friend says he thinks it means that it's trying to make a call to a member of a non object, i.e. the object isn't a class with that function in it.
I'm just a designer, so I'm not sure what all that means, but it sounds helpful
Thanks again for your help. Our company is re-organizing, and I don't have access to a programmer at work anymore. What I really need is a tiny miniature programmer to keep in my purse!
Posted: Tue Jun 07, 2005 5:48 pm
by garvinhicking
Jessi - this is quite strange. You are using at least Serendipity 0.8, right?
Did you modify any Serendipity core files? In your file include/genpage.inc.php you should see the line serendipity_smarty_init() and this is called before the config.inc.php is included.
What's the URL to your blog? You should not call the config.inc.php file manually, it gets called within Serendipity...
Regards,
Garvin
Posted: Tue Jun 07, 2005 6:14 pm
by Jessi Miller
Yes, I'm using Serendipity 0.8 and PHP 4.3.9, according to the admin footer.
I personally did not modify any core files, and i don't think it's likely that the former programmer did, but he could have.
When I look inside genpage.inc.php, this is what I see:
Code: Select all
(snip)
include_once('serendipity_config.inc.php');
include_once(S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php');
include_once(S9Y_INCLUDE_PATH . 'include/plugin_internal.inc.php');
serendipity_plugin_api::hook_event('genpage', $uri);
serendipity_smarty_init();
// For advanced usage, we allow template authors to create a file 'config.inc.php' where they can
// setup custom smarty variables, modifiers etc. to use in their templates.
@include_once $serendipity['smarty']->template_dir . '/config.inc.php';
(snip)
So that looks like it's right.
AFAIK, I'm not calling config.inc.php manually. Here's the category.tpl code:
Code: Select all
<!-- CONTENT START -->
<h3 class="serendipity_date">{$head_title}</h3>
{if $Category.category_description}
<div>{$Category.category_description}</div>
{/if}
{$content_message}
{$ENTRIES}
{$ARCHIVES}
<!-- CONTENT END -->
Here's the url with the v2 template applied - please excuse the mess!
http://www.litique.com/works/ I've abandoned the visual part of this template and am working on v3 from a different base template.
Maybe I messed it up by copying the index.tpl into the template directory so that I could make my own header? I just commented out the old serendipity banner (using html comments) and added in my own graphic and header links.
Other templates seem to work just fine, so hopefully it's just something in this template's directory.
Posted: Wed Jun 08, 2005 10:16 am
by garvinhicking
Hehe, I'm so stupid.
In the file I told you to use "$serendipty", but it needs to be spelled "$serendipity". I'm so sorry. If you use that, it hopefully should work, and you can remove the ERRORLEVEL* directives again to turn off the warning messages in your PHP script...
Regards,
Garvin
Posted: Wed Jun 08, 2005 3:32 pm
by Jessi Miller
Aha! I never thought to check the spelling. I'm so glad it's only a typo and not some huge mangey problem!
It works perfectly now, thank you so much for your help. I'd like to give back to s9y by desigining some templates in my spare time, so keep an eye out!