Custom template name not listed

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
eric@empulsys.com
Regular
Posts: 9
Joined: Sun Dec 11, 2011 5:29 pm

Custom template name not listed

Post 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
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Custom template name not listed

Post 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
?
=Don=
eric@empulsys.com
Regular
Posts: 9
Joined: Sun Dec 11, 2011 5:29 pm

Re: Custom template name not listed

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Custom template name not listed

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
eric@empulsys.com
Regular
Posts: 9
Joined: Sun Dec 11, 2011 5:29 pm

Re: Custom template name not listed

Post 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
Attachments
Manage Styles Section view
Manage Styles Section view
ManageStylesSection.png (77.23 KiB) Viewed 6154 times
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Custom template name not listed

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
eric@empulsys.com
Regular
Posts: 9
Joined: Sun Dec 11, 2011 5:29 pm

Re: Custom template name not listed

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Custom template name not listed

Post 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?
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Custom template name not listed

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
eric@empulsys.com
Regular
Posts: 9
Joined: Sun Dec 11, 2011 5:29 pm

Re: Custom template name not listed

Post by eric@empulsys.com »

Sure

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

Cheers,
Eric
Attachments
BlankStyle.png
BlankStyle.png (180.91 KiB) Viewed 6140 times
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Custom template name not listed

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
eric@empulsys.com
Regular
Posts: 9
Joined: Sun Dec 11, 2011 5:29 pm

Re: Custom template name not listed

Post by eric@empulsys.com »

Now it get's tricky.
It works OK in a local install (xampp install on PC)..........
eric@empulsys.com
Regular
Posts: 9
Joined: Sun Dec 11, 2011 5:29 pm

Re: Custom template name not listed

Post 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.
eric@empulsys.com
Regular
Posts: 9
Joined: Sun Dec 11, 2011 5:29 pm

Re: Custom template name not listed

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Custom template name not listed

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply