Page 1 of 1

Categories vanish when plugin_categories.tpl copied in root.

Posted: Wed Mar 29, 2006 7:56 pm
by WonkoDSane
I suspect this is a newb problem, but I couldn't find any explicit information in the FAQ or in this forum.

I'm using s9y1.0beta2

In my admin/plugins/categories page I have chosen "Enable Smarty Templates? Yes"

I have copied the serendipity/templates/default/plugin_categories.tpl to my new template's root (so I can edit it). I have also ensured that those files are owned by the webserver user and group. (chown apache:apache)

Without making any changes anywhere else, when I refresh any normal entry in my s9y install, my categories are now gone. The 'category' plugin title remains, but all content is now missing.

I suspect I need to add more style directives to style.css in order to regain my categories listing, but I do not know what the style IDs and classes are. It is also possible that I am completely wrong and this is unrelated to style.css.

Any help is greatly appreciated.

Thanks!

Re: Categories vanish when plugin_categories.tpl copied in r

Posted: Thu Mar 30, 2006 12:18 pm
by garvinhicking
Does the output work with having enabled the smarty templates and using the default template?

It sounds as if s9y cannot read or find that categories.tpl file. Did you look into the HTML output of your page, are there any error messages?

Regards,
Garvin

Posted: Thu Mar 30, 2006 1:36 pm
by WonkoDSane
Firefox shows no errors in the HTML source.

I switched back to the default template and it works fine there.

I was trying to use carl_contest/s9y v3.0 as the basis for my new layout. What would prevent me from simply copying plugin_categories.tpl from the templates/default/ directory into templates/newtemplate/ (where I have already copied the rest of the files from carl_contest) and editing the categories template from there?

Again, I suspect some sort of disconnect between the template and style.css causing the problem, but I am too new to s9y to make a call. Unfortunately my s9y installation is inward-facing, and I can't provide a link for you to look at it directly.

Posted: Thu Mar 30, 2006 2:34 pm
by garvinhicking
Hi!

The CSS should not be responsible for that! How does the plugin_categories.tpl file look like that you copied from /templates/default to /templates/newtemplate? Is it unmodified?

When you change other files in your "newtemplate" directory, like the index.tpl or entries.tpl, do those changes show up properly? Because currently it looks like a permission problem to me.

Best regards,
Garvin

Posted: Thu Mar 30, 2006 3:24 pm
by WonkoDSane
I opened the doors wide and chmod 777 * in templates/newtemplate/ and still no luck.

The plugin_categories.tpl in templates/newtemplate/ is currently unmodified from the version found in templates/default/

Altering the index.tpl did cause a change in my output. (I stuck in a "Hello world!" line down in Carl's credits at the bottom of the template.)

Here's a small portion of the screen shot:
Image

And here's the contents of my templates/newtemplate/ directory:
drwxrwxrwx 3 apache apache 4096 Mar 28 09:14 admin
-rwxrwxrwx 1 apache apache 902 Mar 28 09:14 entries_summary.tpl
-rwxrwxrwx 1 apache apache 10020 Mar 28 09:14 entries.tpl
drwxrwxrwx 2 apache apache 4096 Mar 28 09:14 img
-rwxrwxrwx 1 apache apache 2197 Mar 30 08:03 index.tpl
-rwxrwxrwx 1 apache apache 54 Mar 28 09:17 info.txt
-rwxrwxrwx 1 apache apache 1982 Mar 28 09:14 plugin_calendar.tpl
-rwxrwxrwx 1 apache apache 1239 Mar 28 15:05 plugin_categories.tpl
-rwxrwxrwx 1 apache apache 6965 Mar 28 09:14 preview.png
-rwxrwxrwx 1 apache apache 58108 Mar 28 09:14 screenshot.png
-rwxrwxrwx 1 apache apache 395 Mar 28 15:25 sidebar.tplbak
-rwxrwxrwx 1 apache apache 14903 Mar 28 11:17 style.css
Am I missing something in this directory or will the default plugin_categories.tpl just not play nicely with templates/carl_contest/ ?

Posted: Thu Mar 30, 2006 3:36 pm
by garvinhicking
Hi!

Hhhm, I'm somehow not understanding how this can happen.

Could you please try to edit your include/plugin_internal.inc.php file and search for this codE:

Code: Select all

            echo serendipity_smarty_fetch('CATEGORIES', 'plugin_categories.tpl');
and modify this to:

Code: Select all

            echo serendipity_smarty_fetch('CATEGORIES', 'plugin_categories.tpl', true);
            echo "File: " . serendipity_getTemplateFile('plugin_categories.tpl', 'serendipityHTTPPath');
Regards,
Garvin

Posted: Thu Mar 30, 2006 3:51 pm
by WonkoDSane
The new output is:

File: templates/newtemplate/plugin_categories.tpl

Just for giggles, I am including the contents of plugin_categories.tpl

Code: Select all

{if $is_form}
<form id="serendipity_category_form" action="{$form_url}" method="post">
    <div id="serendipity_category_form_content">
{/if}

    <ul id="serendipity_categories_list" style="list-style: none; margin: 0px; padding: 0px">
{foreach from=$categories item="plugin_category"}
        <li style="display: block;">
        {if $is_form}
            <input style="width: 15px" type="checkbox" name="serendipity[multiCat][]" value="{$plugin_category.categoryid}" />
        {/if}

        {if !empty($category_image)}
            <a class="serendipity_xml_icon" href="{$plugin_category.feedCategoryURL}"><img src="{$category_image}" alt="XML" style="border: 0px" /></a>
        {/if}

            <a href="{$plugin_category.categoryURL}" title="{$plugin_category.category_description|escape}" style="padding-left: {$plugin_category.paddingPx}px">{$plugin_category.category_name|escape}</a>
        </li>
{/foreach}
    </ul>

{if $is_form}
    <div class="category_submit"><input type="submit" name="serendipity[isMultiCat]" value="{$CONST.GO}" /></div>
{/if}

    <div class="category_link_all"><a href="{$form_url}" title="{$CONST.ALL_CATEGORIES}">{$CONST.ALL_CATEGORIES}</a></div>

{if $is_form}
    </div>
</form>
{/if}

Posted: Thu Mar 30, 2006 4:27 pm
by judebert
Check your CSS for serendipity_category_form, serendipity_category_form_content, and serendipity_categories_list. I believe if any of them are set to display:none; then nothing will be displayed.

Any chance we can look at your blog ourselves?

Posted: Thu Mar 30, 2006 4:37 pm
by WonkoDSane
No. In fact there are no settings in the carl_contest/style.css for serendipity_category_*

Right now I am running carl_contest with no alterations except for a couple of color code changes. It is copied into my templates/newtemplate/ directory.

I wish I could offer access, but it is internal to my organization's network and I am unable to poke holes in the firewall.

I appreciate everyone's help on this, though.

Posted: Thu Mar 30, 2006 5:34 pm
by garvinhicking
Hi!

Hm, as you can see in the output, the filename to the smarty file is alright. I don'T really know why that is; can you access the .tpl file from your browser?

Can you write a little PHP script:

Code: Select all

<?php
echo file_get_contents('templates/newtemplate/plugin_categories.tpl');
?>
and execute that to see if the file can be included?

Regards,
Garvin

Posted: Thu Mar 30, 2006 6:00 pm
by WonkoDSane
The test script performed as you'd expect. plugin_categories.tpl is readable.

The output (*****xxxxx***** indicates a button or checkbox):
{if $is_form}
{/if}
{foreach from=$categories item="plugin_category"} *****CHECKBOX VISIBLE HERE*****{if $is_form} {/if} {if !empty($category_image)} XML {/if} {$plugin_category.category_name|escape}
{/foreach}

{if $is_form}
*****BUTTON VISIBLE HERE {CONST_GO}*****
{/if}
{$CONST.ALL_CATEGORIES}
{if $is_form}
{/if}
This makes me wonder if there isn't something in the default template that is missing from carl_contest that is allowing for Smarty Templates to work for the categories plugin on one but not the other.

Has anyone been able to duplicate this problem on a test installation?

Posted: Thu Mar 30, 2006 6:04 pm
by judebert
Are the categories in the HTML source (CSS/display problem) or missing from the source (plugin/data problem)? You mentioned earlier there were no FF errors; now I'm asking about the desired source itself.

For debugging, let's see if that {foreach} ever gets called. Just before the {/foreach}, you could add this:

Code: Select all

{foreachelse}
  <li>No categories found</li>
{/foreach}

Posted: Thu Mar 30, 2006 6:27 pm
by WonkoDSane
OK, sequence of events:

I added the code (or thought I had), except I allowed an error in.

Reloaded the page: Fatal error unescaped tag or some such.

Corrected the code.

Reloaded the page: The categories appeared.

This strikes me as odd.

I removed those lines and it still works.

This strikes me as even more odd.

Is it to do with the way Smarty caches .tpl files? Or am I just the victim of a bizarre conspiracy?

Note: I also tried using the templates/default/plugins_categories.tpl again to see if the problem would return and it did not.

Needless to say, anomalous behavior on a production machine makes me nervous.

Posted: Thu Mar 30, 2006 6:37 pm
by garvinhicking
Now, this sounds extremely odd! I guess you're the suspect of a hyperflux anomaly. Can't be something else.

%-)

Posted: Thu Mar 30, 2006 7:19 pm
by WonkoDSane
I suspect that the breaking of the file is what got the ball rolling.

Who knows?

Either way, thanks Garvin and Judebert.

When I set up s9y on my personal machine I'll certainly post the results here, and any templates I manage to get built I'll also post here as well.