Page 1 of 2

Custom template name not listed

Posted: Wed Dec 14, 2011 8:28 pm
by eric@empulsys.com
Hiya,

I am using the 'Properties/Templates of categories' plugin in order to set specific templates for specific categories.

The site (www.mindonrequirements.nl) is working fine but for some reason the plugin does not show the name of my 'custom' templates. So when I want to configure a category and use the drop down menu in the 'select template' section (after 'or'), I can see all 'default' templates but not the ones i customized.

I have checked the info.txt file a couple of times now, but am probably overlooking something.

Suggestion where to look are most welcome.

Thanks in advance.

Best,
Eric

Re: Custom template name not listed

Posted: Thu Dec 15, 2011 12:28 am
by Don Chambers
Eric - are you 1) creating a custom folder for your template, ie /templates/MYFOLDERNAME, and 2) within that folder, creating a custom info.txt file that is unique, such as :

Code: Select all

Name: My Unique Template Name
Author: Me
Date: 2011-12-14
?

Re: Custom template name not listed

Posted: Thu Dec 15, 2011 5:07 pm
by eric@empulsys.com
Hi Don,

Yes I have created a folder (called MindOnX) in the templates directory and in that folder is an info.txt file with the following content.

Code: Select all

Name: MindOnX
Author: Eric Lopes Cardozo
Date: 2011-12-11
Require Serendipity: 1.2
Best,
Eric

Re: Custom template name not listed

Posted: Thu Dec 15, 2011 6:22 pm
by garvinhicking
Hi!

Does the template itself shown up in your s9y "Manage Styles" section, or is it missing there as well?

What other files are in your mindonx/ directory? And is the directory and files therein readable for the webserver?

Regards,
Garvin

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 8:28 am
by eric@empulsys.com
Hi Gavin,

Yes, it shows up like other templates in the 'Manage Styles' section (see attachment)

These are the files in the MindOnX folder.
admin\style.css
admin\image\ <.png's and .gif's>
img\ <.png's and .gif's>
entries.tpl
entries_summary.tpl
index.tpl
info.txt
plugin_calendar.tpl
preview.png
preview_fullsize.jpg
screenshot.png
style.css

The webserver seems to process all files. When accessed through a browser you get to see or the website (blog post) or a "You don't have permission to <file> on this server" message.

Thanks,
Eric

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 2:56 pm
by garvinhicking
Hi!

That's absolutely odd; both manage styles and the dropdown for templates use the same internal s9y function.

You could try to create a test.php file in your s9y directory, with this content:

Code: Select all

include 'serendipity_config.inc.php';
$templates = serendipity_fetchTemplates();
echo '<pre>' . print_r($templates, true) . '</pre>';
And report what that gives you as output if you call the testphp in your browser.

Regards,
Garvin

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 3:32 pm
by eric@empulsys.com
This is the output Gavin:

Code: Select all

Array
(
    [1024px] => 1024px
    [blue] => blue
    [bulletproof] => bulletproof
    [carl_contest] => carl_contest
    [competition] => competition
    [contest] => contest
    [default] => default
    [default-php] => default-php
    [default-rtl] => default-rtl
    [default-xml] => default-xml
    [elc_v1] => elc_v1
    [idea] => idea
    [kubrick] => kubrick
    [mindonbiz_v1] => MindOnBiz_v1
    [mindonprj_v1] => MindOnPrj_v1
    [mindonreq_v1] => MindOnReq_v1
    [mindonx] => MindOnX
    [moz-modern] => moz-modern
    [mt-clean] => mt-clean
    [mt-georgiablue] => mt-georgiablue
    [mt-gettysburg] => mt-gettysburg
    [mt-plainjane] => mt-plainjane
    [mt-rusty] => mt-rusty
    [mt-trendy] => mt-trendy
    [mt3-chalkboard] => mt3-chalkboard
    [mt3-gettysburg] => mt3-gettysburg
    [mt3-independence] => mt3-independence
    [mt3-squash] => mt3-squash
    [newspaper] => newspaper
    [roundedcorner] => RoundedCorner
    [wp] => wp
)
The MindOnX template is in there.

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 5:08 pm
by garvinhicking
Just to be sure we're talking of the same thing; can you show me a screenshot of the place where you are missing your template name?

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 5:12 pm
by garvinhicking
Hi!

Also, in the serendipity_event_categorytemplates.php file you should find this:

Code: Select all

            <select name="serendipity[cat][drop_template]">
                <option value=""><?php echo NONE; ?></option>
<?php
                    foreach ($styles AS $style => $path) {
                        $templateInfo = serendipity_fetchTemplateInfo($style);
?>
            <option value="<?php echo htmlspecialchars($style); ?>" <?php echo ($style == $template? 'selected="selected"' : ''); ?>><?php echo htmlspecialchars($templateInfo['name']); ?></option>
<?php
                    }
?>
            </select>

maybe you can change that to:

Code: Select all

            <select name="serendipity[cat][drop_template]">
                <option value=""><?php echo NONE; ?></option>
<?php
                    foreach ($styles AS $style => $path) {
                        $templateInfo = serendipity_fetchTemplateInfo($style);
                        print_r($templateInfo);
?>
            <option value="<?php echo htmlspecialchars($style); ?>" <?php echo ($style == $template? 'selected="selected"' : ''); ?>><?php echo htmlspecialchars($templateInfo['name']); ?></option>
<?php
                    }
?>
            </select>

And then check out the HTML sourcecode of the page where you see the HTML template dropdown to see what information is at the place of that <select>.

Regards,
Garvin

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 5:28 pm
by eric@empulsys.com
Sure

I'll also go check you coding suggestion
Thanks for the help so far.

Cheers,
Eric

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 5:37 pm
by garvinhicking
Hi!

Ah, seems to me that simply the info.txt cannot properly be parsed. The entry in the select is there, it just doesn't show the name. BTW, in the input box you need to enter the directory name of the template, not the "displayed name" of a template.

What exactly does your custom info.txt file look like? Could it be that you saved the file with a UTF-8 BOM so that the beginning of the file does not read "Name: XXX" but instead "<UTF8BOM>Name: XXX" that most editors don't display? Make sure to save the file without BOM.

HTH,
Garvin

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 5:39 pm
by eric@empulsys.com
Now it get's tricky.
It works OK in a local install (xampp install on PC)..........

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 7:10 pm
by eric@empulsys.com
I don't understand.

This is the output on the hosted site

Code: Select all

Array
(
[name] => Kubrick 1.2.6 port
[author] => Tom Sommer
[date] => 12/8-2004
[custom_admin_interface] => Nee
)
<option value="kubrick">
Kubrick 1.2.6 port
</option>
Array
(
)
<option value="mindonx">
</option>
Array
(
[name] => Mozilla Modern Tribute
[author] => Garvin Hicking
[date] => 2004-03-02
[require serendipity] => 0.8
[custom_admin_interface] => Nee
)
And this is the output on the local site that works OK.

Code: Select all

<option value="kubrick">
Kubrick 1.2.6 port
</option>
<option value="mindonx">
MindOnX
</option>
<option value="moz-modern">
Mozilla Modern Tribute
</option>
The question is what is 'normal'
I first tried it local and then FTPed serendipity_event_categorytemplates.php to the hosted site.

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 7:28 pm
by eric@empulsys.com
I switched my site's template to Greenmile, removed my MindOnX temlate, FTPed MindOnX back and now I have the same issue with both Greenmile and MindOnX templates.

I have no idea what's happening.
Maybe a reinstall of 1.6.

Cheers,
Eric

PS.
I saved the info.txt file explicitely as UTF-8.
No change.

Re: Custom template name not listed

Posted: Fri Dec 16, 2011 7:29 pm
by garvinhicking
Hi!

Your info.txt file does not seem to get parsed or cannot be read on the hosted site. You can see that because the info array is empty, whereas for other templates you see name, date etc.

Make sure you upload info.txt with unix linebreaks and FTP transfer it BINARY, not ASCII.

Regards,
Garvin