Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Includes files displaying differently on home page


Go to End


14 Posts   3556 Views

Avatar
honeybunny

Community Member, 79 Posts

2 February 2010 at 3:10am

I'm trying to figure out why my includes files are displaying forms incorrectly on the home page. The search and poll forms both call to the correct styling when they display on article pages and blog pages, but are defaulting to a generic style for the home page. I've tried flushing many times and tested on other computers and the search form and poll continue to style incorrectly when I use the includes file.

It's not a critical problem as the files display correctly if I put $SearchForm or $MyPoll directly in the homepage.ss template, but I would like to find out why the includes works everywhere except the home page.

Thanks!

HB

Avatar
go2planC

Community Member, 19 Posts

2 February 2010 at 10:08am

Hi honeybunny,

you could try flush=all

Are your include lines included within homepage.ss or page.ss? You may want to just double check both your div and class names just in case you have made a slight typo.

If you are still having problems paste some example lines of code here and I'll have a look.

hope this helps.
Rob

Avatar
honeybunny

Community Member, 79 Posts

2 February 2010 at 4:31pm

Hi Rob!

The include files are in HomePage.ss, ArticleHolder.ss and BlogHolder.ss. Everything displays correctly in the ArticleHolder.ss and BlogHolder.ss files, but the two forms (search and polls) are going wonky on the home page. I've gone back and looked at the source for the rendered pages and discovered that the include is being commented out on the homepage even though it is entered exactly the same in the ss file for all the holder pages.

Here is how it is entered in the HomePage.ss file:

<div class="col3">
<!-- Row 1 Column 3 start -->
<% include Side1 %>

<!-- Column 3 end -->

============================================================================================
This is how it is being rendered:

<div class="col3">
<!-- Row 1 Column 3 start -->
<!-- include /home/nhstylec/public_html/themes/NHSyellow/templates/Includes/Side1.ss -->
<div class="typography>
<form id="SearchForm_SearchForm" action="/nhstyle/SearchForm" method="get" enctype="application/x-www-form-urlencoded">
<fieldset>

<legend></legend>

<div id="Search" class="field text nolabel"><div class="middleColumn"><input type="text" class="text nolabel" id="SearchForm_SearchForm_Search" name="Search" value="Search" /></div></div>

<input class="action" id="SearchForm_SearchForm_action_results" type="submit" name="action_results" value="Search" title="Search" />

</fieldset>
</form>
<br/>
<a href="/lucy/" title="Go to the &quot;Lucy's Fave's&quot; page">Lucy's Faves</a><br/>
<a href="/blog/" title="Go to the &quot;Blogs&quot; page">Blogs</a><br/>
<a href="/lucy/" title="Go to the &quot;Lucy's Fave's&quot; page">Lucy's Faves</a>
</div>

<!-- end include /home/nhstylec/public_html/themes/NHSyellow/templates/Includes/Side1.ss -->

<!-- Column 3 end -->
</div>
</div>

I'm also having a problem displaying excerpts/summaries of articles from article pages and blog entries on the homepage. They work fine if the article is just text, but SS is inserting line breaks when the blog entry or article page contains a graphic image. The files display correctly on the ArticleHolder and BlogHolder pages, but break on the homepage. Given both these problems I assumed that I had some wayward code on the homepage that was creating the issue, but after going line by line comparing the homepage with the articlepage I didn't find anything obvious. (open divs, missing brackets, etc...)

I did try flush=all and I also tried logging in on another computer in case mine wasn't clearing the cache properly. I probably spent five or six hours trying to fix what I thought was a form problem before I realized that the problem was only happening on the homepage.

Any insights, no matter how obvious or insignificant they may seem to you, are greatly appreciated.

HB

Avatar
go2planC

Community Member, 19 Posts

3 February 2010 at 2:44am

Hi HB,

It's been a long time since I did the tutorial files for SS however if I remember correctly there is a 3 column layout and the poll and search forms are placed on the right hand one. Is this correct?

so let's have a quick look these 2 lines of code:

<!-- include /home/nhstylec/public_html/themes/NHSyellow/templates/Includes/Side1.ss -->
<div class="typography>

the first line is commented out line is just there as a guide to let you know that the templates Side1.ss is being used (starting). You will notice further down the code there is a closing comment too.

<!-- end include /home/nhstylec/public_html/themes/NHSyellow/templates/Includes/Side1.ss -->

Note: These lines only appears when in development mode.

The next line is where I think you're problem may be. class="typography" is normally reserved for the content of your page ($content). Try removing the class="typography" and check in your CSS if you need a different class name.

If you're still having problems with it if you could attach all the relevant files to this post and I'll have a closer look.

Could you also paste some of the code you are using for excerpts/summaries part as well.

good luck :)
Rob

Avatar
honeybunny

Community Member, 79 Posts

3 February 2010 at 3:54am

Hi Rob!
I removed the <div class="typography> </div> but it didn't make a difference.

I'm not sure what you mean by being in development mode. I know what it is, but not how I would have gotten there. I thought that SS defaulted to live mode and that I would have had to specifically tell config.php that I wanted to be in dev mode. Also why would this only affect the homepage and not any of the other pages? (The other pages display the forms correctly and do not have the include in comments.)

I'm late for the gym right now but will try to get a screen print of some code later today.

I really appreciate your help with this. I started out assuming that I had a typo on the homepage.ss file but didn't find anything. The fact that the forms work if they are coded on the page rather than "included" rules out a conflict or coding error. (I mean how could I screw up <% include Side1 %> ) It really is the kind of thing that could send a girl around the bend...

HB

Avatar
go2planC

Community Member, 19 Posts

3 February 2010 at 8:30am

Hi HB

Sorry, I feel a little stupid for not noticing it earlier but I didn't have dreamweaver open at the time. Not sure if it will solve the problem but let's fix it first and see what happens.

In your first line of code you're missing a quotation mark.

<div class="typography>

should be : <div class="typography">

(we all make this kind of mistake :) )

regarding development mode, admittedly I may have used the wrong terminology was at work and didn't have too much time. The commented out line is just a guide for you to see what template (include file) is being used.

I'll be online most of the evening so if you're still having problems either attach a screen shot or upload your files in a zip folder and I’ll have a look. Don't want you going bonkers now do we!?

rob

Avatar
honeybunny

Community Member, 79 Posts

3 February 2010 at 10:58am

Good catch, but I removed that line this morning and it still didn't work. (Perhaps your subconscious noticed the missing " as you were the one to suggest dropping that div...)

It did occur to me that when you said "development" mode you were referring to the fact that I was looking at a draft version vs. a live version so I tried publishing the homepage to see if it made a difference. Unfortunately I'm currently experiencing a 500 error from a failed module install. (Don't ask...) Suffice it to say that instead of loading tables everything went kafluey (sp?) and it locked me out of admin. I deleted the module and can now access the admin interface but I'm still getting server errors when I try to bring up the live website. (Teach me to multi-task...)

Anyhow, I zipped the theme files. Please don't laugh when you open them. I lost my hard drive and my most recent back up was two (okay three) weeks old so they're a bit of a hodge podge from me trying to recreate everything.

Not to worry, I shan't go bonkers. I mean, it's groundhog day, how can anyone lose their mind on the day that we celebrate the dragging of a poor little hibernating creature out of his hole to see if he sees his shadow?

Thanks again!

HB

PS: I'm really not as pathetic as I sound. Most people consider me to be a very patient, efficient, and competent person. Maybe I need to burn a joss stick (or get out of the house once in a while) to change my luck?

Attached Files
Avatar
go2planC

Community Member, 19 Posts

3 February 2010 at 12:53pm

oh dear you sound just like me :)

um ok the bad news is I've just torn you code up cut and paste it all into the correct places and just previewed it as a normal html page and couldn't find anything wrong with it. I've even got the form styling correctly on the homepage. (see attached)

secondly that 500 error you're getting try to delete the .htacess file out of http://www.nhstyle.com/sapphire/ I've had loads of problems with that being there.

Ok had a little too much wine now so all this code is starting to go a little blury so I'll have another look tomorrow. By the way I know this may sound really silly but have you changed the homepage's page type to home page? I just ask because if you look at http://www.nhstyle.com/home/ it's not using the homepage template.

Don't worry we'll get there. It's bound to be something really silly.

Rob

ps. I wonder if that groundhog know's what it is supposed to be doing or is it just like me in the morning and can't function without a cup of tea first? I mean if i was dragged out of hibernation i wouldn't know what the hell to do with myself - let alone look at my shadow.

Go to Top