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.

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   2617 Views


Community Member, 79 Posts

3 February 2010 at 4:13pm

"By the way I know this may sound really silly but have you changed the homepage's page type to home page? "

LOL! You're kidding, right? I think the question should be how many times have you changed the page type? I'm having a problem displaying summaries from article pages and blog entries that contain graphics on the homepage, but I noticed that they display fine on their parent pages, so I thought that changing the page type to BlogHolder or ArticleHolder would make a difference. It didn't. The text only article/blog summaries displayed perfectly but the summaries of articles containing graphics were still inserting several line breaks where the graphic was. I changed the page type via the drop down menu on the behaviour tab on the cms so it should have saved correctly as HomePage once I changed it back, but who knows... I'm sure if I looked at it long enough I would figure it out, but off the top of my head I wouldn't know how to change the page type outside of the cms.

Merde. It just occurred to me that we are talking about different home pages and maybe that is where I am going wrong. The actual "home" page assigned and required by SS is a page and is unused and hidden. The page I am using as the site's home page is the NH Style page. This page uses the template and is assigned the page name "home". (see attached homepage.jpg) I don't remember why or how I decided to set up the NH Style page as the homepage, but it had something to do with SS not allowing me to rename the actual home page in the navigation. Could this perhaps fall under the category of "something really silly"?

I'm generally competent with css and html and it passed W3C validation so I was pretty sure it wasn't a code issue, but it's good to know you didn't find one. (yet) As for the 500 error, I've tried several of the .htaccess suggestions I've found in the forum posts but they haven't worked. I've deleted, edited, and restored the various .htaccess files to their original contents and am still having this cursed server error. It started when I uploaded the subsites module. I couldn't get the tables to load and now I can't get the server error to go away.

Okay, enough for one night. I just realized that I haven't left the house since Sunday. Yikes!! I'll eventually figure this out and get a life. Of course with my luck it will be like a Twilight Zone episode and when I finally go out I'll find that the world has ended or zombies have taken over. Fortunately I live in a really old house so there is probably a fair amount of lead paint to protect me from whatever the aliens or zombies are doing on the outside. Is rambling a sign of senility or insanity? Definitely time for bed.


PS: You would hope that Grandpa Phil would have left journals or something to let the youngins know that being dragged out of bed once a year by an old guy wearing a top hat and tails is the price to pay for the cushy digs. I believe that the official ground hog does get regular meals and a nice home as remuneration for the indignity.

Attached Files

Community Member, 79 Posts

4 February 2010 at 4:13am

Edited: 04/02/2010 5:12am

Good News Rob! I fixed part of the problem. (Can you hear the subdued golf claps in the background?)

It turns out that a bad function may have been the issue. Hamish told me where my server error was coming from and bam! once I changed it (notice I didn't say fixed) the server error disappeared and my includes worked on the homepage. Now the problem is that the search form text input and button are not lining up on the home page or blog holder. They look fine everywhere else, so it's probably not a styling issue, but who knows.

I tried using $SearchForm instead of the includes on the homepage but it didn't fix the alignment. Php is not my forte yet, so I am moving forward on the premise that if there was one php error that kind of sorta worked there is most likely another one on the homepage that is mucking things up. It's also extremely possible that the code I used to get rid of the server error doesn't actually fix the problem. The fact that the article summary on the homepage is still displaying incorrectly is lending credence to that assumption. So hold the virtual presses I am including a copy of the HomePage.php file in the hope that it will shed some light on my problem. It might be a red herring, but until I hear otherwise that is the lead I am following.

Needless to say, I will not try to load any other modules until this is fixed.

Your a peach!

ETA: It's official. My "fix" didn't fix anything. It worked for a while, but when I came back to my desk I was right back to the 500 error. (Instead of subdued clapping the gallery is now sighing and murmuring quietly and shaking their heads.)


Community Member, 19 Posts

4 February 2010 at 7:34am

Edited: 04/02/2010 7:36am

Hi HB,
Give this one a whirl. Hopefully we'll have the crowd cheering again. You had your function in the wrong part of your document plus a couple {} where you didn't need them.

fingers crossed :)


ps. your may not be the best PHP coder in the world but you definitely are a top class comedian. You’ve had me in hysterics the whole way through.


Community Member, 79 Posts

4 February 2010 at 9:46am

Helloooo Rob!
You know what they say, if at first you don't succeed, try, try again...

I went out first thing this morning and brushed the snow off the car, came in had my tea and sat down in front of the computer. It's now 1545 and I'm still sitting here. I see the change you made to my ailing home page php, but it didn't help. It's still giving an error for the parent id line and I don't understand why. I've been through hundreds of forum posts and tried pretty much every variation I could find to make this work and I'm still looking at the same error.

return DataObject::get('ArticlePage', "ParentID = $news->ID","Created DESC", false, $number);

Freaky...someone is banging on my porch door and it's really distracting. (Why do they insist on pulling on the door if you don't answer? Last year the cable guy broke my storm door. He was trying to convince me to sign up for cable. Did he really think breaking down my door was going to induce me to buy????) Do you work at home or an office? Now that I work at home most of the time I find that there are way more strange people wandering the streets (and my backyard) then I ever imagined. Sorry, I am way off topic now.

Okay, so I tried the corrected version of the HomePage.php file but it is still giving the same error. What next? If I delete the FashionNews function the site works no problem, but it's supposed to (someday) be a magazine site and it's kind of important that I be able to link articles to the homepage. I could fake it for now and put a copy of the articles as children of the homepage, but that kind of defeats the purpose of the cms and as I am the only one around here that knows anything about this (scary huh?) it is kind of important that I get this up and running properly so that someday, when I actually have a staff, someone else can easily go in and find the articles and update them. (Who am I kidding? Once I get this working I am not giving anybody admin access to anything.)

The ball is in your court. I was going to tread at three, but it's starting to feel like a cookie day, so I will bake instead. Let me know what you come up with.


PS: I don't think I would call myself a php coder until I could look at the HomePage.php file and know what it says without referring to the twenty stickies plastered on my laptop.


Community Member, 19 Posts

4 February 2010 at 1:58pm

hey HB,

Well I must admit this is starting to drive me around the bend (and I’m sure you've been round there a few times). It is really hard to try and resolve these sort of little bugs through this kind of forum style stuff. I've spent countless hours banging my head against my keyboard trying to work this stuff out only to find it was the most blatant stupid mistakes in the world - luckily I kind of enjoy it ( how weird am I???)

In answer to your question I work both in an office and from home (no rest for the wicked ;) ) Graphic designer by day; coder by night. What I find the most annoying really is when i get graduates or freelancers calling me up and asking me for work (like I really have enough for myself).

I wouldn't normally suggest this but if you want to give me access to your site i will try to get it working for you. As i know you wouldn't want to give me these details (if at all) on this forum you can message me through my site and I’ll have a look. Where do you live anyway - you mentioned it is 1545 where you live where as it is currently 0046 now and I’ve got to get up for work 7 hours. Oh well - maybe you'll bake me some cookies for the effort. :)

Right off to bed for me - I’ve just been out with a lady friend and drank way too much cider to try and understand code at this time of night. Maybe a little more sober tomorrow!

we'll get this working for you :)


Community Member, 79 Posts

5 February 2010 at 3:02am

Hi Rob! It's another fine sunny day here in New Hampshire (northeastern US). It's even warm out. (22f/-6c) Unfortunately I'm going to be spending it inside, at my desk with the curtain closed.

I don't want you to think that I'm just filing my nails and surfing the web waiting for someone to fix my problems. I did some basic php tutorials yesterday and started reading Paul Hudson's php book last night. The feeling I have right now is that line 71 is correct. (It's likely that belief is sheer ignorance on my part, but I'm going with it.) My plan for the day is to backtrack to see if I can figure out what else I may have done last week that might be causing the issue. There are only so many lines on the HomePage.php page, so it's very likely that something else got changed and is disagreeing with the code. I'm also leaning towards reinstalling SS.

My gut feeling is that I may have lost a bracket or some other essential tag in a seemingly unrelated file so I'm going to spend some time on the treadmill then I will sit at my desk and go through every file that I know I've edited in the last week. I may not be great at php, but I do backup or make copies before I change anything so it shouldn't be too hard to compare the files that I intentionally changed. I realize that this won't help if my code was bad to start with, but at least it's doing something.

Also, in following some of the forum threads I did go into Sapphire several times and it's possible that I accidentally changed something. I have a bad habit of saving before closing pages, so I may have unintentionally hit a key and saved the changed without realizing it. I could ftp in to see if any of the files show a recent update, but it would probably be quicker to just reinstall them.

Keep the faith. These little bits of gibberish can get frustrating, but we can't let them get the better of us. The last cms I tried was a nightmare. They had no support system and the forums were just a gaggle of people posting sos messages with no reply. I made a habit of posting what I did to fix my problems so people thought I was an expert and started emailing me for help. Can you imagine? Me, with my ten lines of misplaced code, an expert. My point is that having someone to talk to has been extremely helpful. Just knowing that there are other eyes to point out the mistakes has kept my blood pressure in check.

Thanks again for your help. As you suggested, I'll send an email later.


PS: I don't mean to be funny. I've just got satirical sense of humor and a faulty off switch. Sometimes my mental dialogue just slips out and I end up spending three months apologizing and baking cookies.

Go to Top