View Full Version : Using php within sitebuilder.
kilrootrec
22nd January 2007, 01:38 PM
Hi Paul,
Wondering if you can help me with this one. Im currently working with Scott (from nifootball) where he has supplied me with some .php in order to enable me to display league tables within my site. He has supplied me with the .php file, however could you point me in the right direction of some material that would help me to understand how to incoroporate this code/file into my site using sitebuilder.
Regards,
Phil
paul_r
22nd January 2007, 02:05 PM
ooo errr ... getting clever now!
Haven't done this on the sitebuilder yet so I'm not sure. First thing to try I think is the Widget tool.
Open the sitebuilder > Click 'Edit Layout' tab at the top. When that opens you'll see in the bottom left of the toolbar a little box icon that says 'New' beside it. Click the drop-down arrow > Widgets > PHP Script Box.
I think (emphasis on 'think') that allows you to insert php script into the page. Haven't tried it so can't be sure.
You can try that and see what happens. Then click the 'Preview site' button to see what it does. If it messes anything up it should be easy to remove it again or revert the site back to the way it was before the change. Or try it in that test site we set up in your sitebuilder last week if you haven't deleted it already.
If you're still nervous about that send me the php code and I'll try it on the test site I have for experimenting with death defying tricks like this.
kilrootrec
22nd January 2007, 02:21 PM
ooo errr ... getting clever now!
Haven't done this on the sitebuilder yet so I'm not sure. First thing to try I think is the Widget tool.
Open the sitebuilder > Click 'Edit Layout' tab at the top. When that opens you'll see in the bottom left of the toolbar a little box icon that says 'New' beside it. Click the drop-down arrow > Widgets > PHP Script Box.
I think (emphasis on 'think') that allows you to insert php script into the page. Haven't tried it so can't be sure.
You can try that and see what happens. Then click the 'Preview site' button to see what it does. If it messes anything up it should be easy to remove it again or revert the site back to the way it was before the change. Or try it in that test site we set up in your sitebuilder last week if you haven't deleted it already.
If you're still nervous about that send me the php code and I'll try it on the test site I have for experimenting with death defying tricks like this.
Worked.....very impressed Paul!!
paul_r
22nd January 2007, 02:28 PM
Worked.....very impressed Paul!!
Me too! :1 (40):
kilrootrec
22nd January 2007, 06:52 PM
it worked, however the text came out plain and the table had no defination...any ideas? With the code supplied the text and table should have came out all nicely formatted in various colours but sadly not.
paul_r
22nd January 2007, 07:34 PM
Is that the 'Tables' page?
Not sure, but I'll try to have a look at it tomorrow. My guess is that Scott has used a CSS to apply the formatting but he hasn't given you the CSS file or info. That means the code is looking for formatting information but it can't find it, so goes with the default.
If it is something like that it probably won't be too hard to sort. Can you ask Scott? He'll probably know off the top of his head, and if it is that he could either fix the code so the formatting is included, or give you the CSS file to go with it.
I'm no web coder though so that could be rubbish. :1 (56):
kilrootrec
22nd January 2007, 07:41 PM
aye thats the page.
I will pass this on to Scott to see what he comes up with.
Ta
kilrootrec
23rd January 2007, 12:22 AM
Is that the 'Tables' page?
Not sure, but I'll try to have a look at it tomorrow. My guess is that Scott has used a CSS to apply the formatting but he hasn't given you the CSS file or info. That means the code is looking for formatting information but it can't find it, so goes with the default.
If it is something like that it probably won't be too hard to sort. Can you ask Scott? He'll probably know off the top of his head, and if it is that he could either fix the code so the formatting is included, or give you the CSS file to go with it.
I'm no web coder though so that could be rubbish. :1 (56):
Got the css file off Scott, where do you place it in sitebuilder?
kilrootrec
23rd January 2007, 12:38 AM
Ok, will try to word that better.
I now have a .php file from Scott (tables.php) and a .css file (kilroot.css).
Within the .php file is a link/target to the .css file which pulls in the formatting information for the tables etc. The link within the .php file needs to be pointed to whereever the .css file is stored, this is where I get stuck.
I am aware of the different stylesheets within the sitebuilder and the abilty to create a new one, however is it possible to store the .css file Scott has sent me into the sitebuilder in some way, so as I can then point the .php file to it.
Hope that makes a little more sense this time.
Cheers
Phil
paul_r
23rd January 2007, 02:13 AM
...is it possible to store the .css file Scott has sent me into the sitebuilder in some way, so as I can then point the .php file to it.
Yes, should be easy.
You can use the File Manager in the main Direct Admin control panel (or an ftp client if you use one) to upload the css file to wherever you want it. Then just make sure the code in the php file includes the correct path to where you put it.
I'd suggest you create a folder called 'CSS' or 'styles' (something obvious like that) within the public_html folder. Then upload the css file to there. Then change the code in the php file to include that path in the line where it refers to kilroot.css
If that's not clear (it's late and I've been at the Belfast Telegraph Sports Awards all night :1 (49): ) we can sort it out by phone pretty quickly.
Let me know how you get on.
paul_r
23rd January 2007, 11:47 AM
Had a quick look at that. The code that's there now has the path /css/kilroot.css
So ... if we create a folder called 'css' in the public_html directory and upload the kilroot.css file to there I think that should work.
In fact I just created the css folder for you, so just drop the css file into that and see what happens.
I'm not 100% sure if the path in the php code takes us back to public_html because I'm not sure where the php file is located, so we may have to experiment with that a little.
I couldn't see the kilroot.css file anywhere or I would have tried it. I assume you haven't uploaded that yet?
kilrootrec
23rd January 2007, 01:02 PM
Had a quick look at that. The code that's there now has the path /css/kilroot.css
So ... if we create a folder called 'css' in the public_html directory and upload the kilroot.css file to there I think that should work.
In fact I just created the css folder for you, so just drop the css file into that and see what happens.
I'm not 100% sure if the path in the php code takes us back to public_html because I'm not sure where the php file is located, so we may have to experiment with that a little.
I couldn't see the kilroot.css file anywhere or I would have tried it. I assume you haven't uploaded that yet?
Where do I find the public_html directory?
paul_r
23rd January 2007, 02:09 PM
In the main control panel look in the top menu with the 5 icons. Last on the right is 'Files'. That takes you into the File Manager, which is where you can upload/delete files and folders, edit files etc. It's a useful and powerful tool but bear in mind that as with a good power tool you can do a lot of damage with it too!
Click the Files icon and you'll see a number of folders (4 I think) plus a number of files. Click on the public_html folder (It'll have a red arrow on it). public_html is THE main folder for your site. Your entire website sits in there and that's the only folder you should ever need to go into at that top level in the File Manager.
In public_html you'll find another load of folders and files which make up your site. I won't name them all here for security reasons but you'll see one called 'css' that I created earlier. To upload a file such as your kilroot.css into that folder ...
Click in the css folder (there's nothing in there at the minute)
at the bottom of that screen click on the 'Upload files to current directory' button
there are then shown 8 upload slots (so you could upload up to 8 files at a time)
click the 'Browse' button beside slot 1 and browse to where you have saved kilroot.css on your PC
when you find it double click to place in the number 1 slot
click the 'Upload Files' button
Done. kilroot.css should now be uploaded into the css folder withing public_htmlTo see if that worked open your website and browse to the 'Tables' page and see what's happened. If the site was already open remember you'll need to refresh the page to see any changes.
The same method can be used to upload other stuff you may want to have on your site, e.g. downloadable documents. I think I have a tutorial on here somewhere for how to do that.
There are also Help pages at http://webhelp.visport.co.uk/ where you'll see text help links, plus at the top see the link to Video tutorials. The videos are great for the features they cover. Click the link to DA Control Panel and look in the menu under 'Direct Admin (enhanced) - End User. About half way down there's a Tutorial called 'Using File Manager' which covers what I've described about almost exactly, but there you'll see exactly what it looks like on screen.
kilrootrec
23rd January 2007, 02:26 PM
Paul,
my control panel is very different from the one your describing and the one within the tutorial???
Phil
paul_r
23rd January 2007, 02:31 PM
Sorry. I'm referring to your main website control panel - not your sitebuilder control panel. You can't upload the file the way we're talking about through the sitebuilder.
The instructions for accessing that are in your Welcome email. Normally the only time you'll need in there is for something like this or to set up email accounts.
If you don't want the hassle of getting into that at the minute send me the css file by email and I'll drop it in there so we can see if that works.
kilrootrec
23rd January 2007, 02:35 PM
No Im better trying to do it myself this time, then I wont have to bother you the next time. (well that sounds good in practise anyway!!)
kilrootrec
23rd January 2007, 03:13 PM
ok.
I have never set up the vpn for cpanel and im in work at the moment so dont fancy setting it up in my works network. i will set it up later tonight from home.
In the meantime if I sent you the .css file could you place it within the _html folder?
paul_r
23rd January 2007, 03:20 PM
if I sent you the .css file could you place it within the _html folder?
Sure. websites@visport.co.uk will find me.
paul_r
23rd January 2007, 03:44 PM
ok, that's sorted ... sort of. It's picking up the css file ok but it looks like the css may be short of some info. Have a look and you'll see what I mean. Scott will see what's missing at a glance 0 just the text colours for the headings as far as I can see. I'll have a look now and see if I can tweak those.
The correct path was ../css/kilroot.css btw
paul_r
23rd January 2007, 03:50 PM
Actually the css looks ok to me. I'm wondering if there's some restriction within the sitebuilder about colours. I know the colour range is limited in that. I'll have a look at what colours ARE available in the sitebuilder and try changing to some of those.
kilrootrec
23rd January 2007, 04:06 PM
I see what ypu mean about the tes=xt colour for the headings.
Also there should be a line between 2nd and 3rd place and 12th/13th or 13th/14tg (3D), would sitebuilder support lines like this?
paul_r
23rd January 2007, 05:04 PM
Not sure exactly what's going on there but it appears that the sitebuilder will pick up the background colour css info ok, but not the font. I'm guessing that somehow the sitebuilder is over-riding the css info for fonts.
It's definately a sitebuilder thing - I copied the php and css files to a test site and they come out fine in the intended colours (except the line is still missing).
For now I've changed the colours on the title bars so that the text can be read ok. They might not be everyones colour choice but I've sorta run out of time for now. :pcguru:
If you have specific colours you'd like in there it's really easy to change them by using the File Manager in the main control panel and clicking 'Edit' beside the kilroot.css file. There are only 4 options in the css and it's pretty obvious which is for the titles, etc. You'll need to know the #code for the colours you want, e.g. #FFFFFF is white, etc.
I'm also going to enquire from the sitebuilder people how that can be changed, if at all.
Not sure why the line is missing either. That might be one for Scott.
kilrootrec
23rd January 2007, 05:11 PM
Thanks for all the effort again Paul..
ps see what you mean about the colours not being to everyones taste!!
paul_r
23rd January 2007, 05:14 PM
see what you mean about the colours not being to everyones taste!!
:care:
:laugh:
kilrootrec
23rd January 2007, 05:48 PM
issues.....!!!!
Does the .css default to all pages?? the rest of the site now look quite messed up, eg fixtures/results page!
paul_r
23rd January 2007, 06:14 PM
Does the .css default to all pages??
No, don't worry about that.
Part of the problem there was my fat fingers, where I tried changing some stuff trying to get the table formatting working.
I'd changed the font type. I've fixed that bit but I'm fairly sure looking at the fixtures pages that maybe you adjust the box widths or something? The top box was a bit too narrow so it had made the rows deeper to allow a word wrap. That made the box extend downwards so it overlapped with the lower box. I was just in the middle of adjusting that when I got kicked out - probably because you logged in andd took over the session lol!
If you're happy enough to sort it yourself, no prob. If you want a hand to fix it just let me know.
paul_r
23rd January 2007, 06:28 PM
Straightened the fixtures out a bit. Still not perfect as the two boxes aren't quite the same width but I'll get that ok.
That'll teach you to complain about my colour scheme :whistling:
kilrootrec
23rd January 2007, 06:34 PM
Look i just said some people might not like it...no need for you to sabotage my site over one silly comment !!!
kilrootrec
23rd January 2007, 06:36 PM
I think the font has changed in the tables, i will mess about with them tonight!
paul_r
23rd January 2007, 06:45 PM
Look i just said some people might not like it...no need for you to sabotage my site over one silly comment !!!
You should see the mess I can make when I'm really upset :1 (62):
I think the font has changed in the tables, i will mess about with them tonight!
Maybe. It's easy enough to change the font size in the tables.
I lined up the First and Seconds boxes now.
kilrootrec
23rd January 2007, 07:27 PM
Is there a way to change the font in tables withiout having to select each cell individually?
kilrootrec
23rd January 2007, 10:23 PM
Is there a way to change the font in tables withiout having to select each cell individually?
:1 (38): found it.
paul_r
23rd January 2007, 10:23 PM
I kinda guessed you might be on asking that, because I was looking for the same thing before I left work. Didn't spot it then, yet I'm fairly sure I saw a way to do that once before (months ago though so I can't remember how).
Have you checked the tutorials from the link I posted earlier?
paul_r
23rd January 2007, 10:39 PM
:1 (38): found it.
Well? Share with me! :saywha:
paul_r
23rd January 2007, 10:46 PM
btw - I was off having a look before I saw your post saying you'd found it. You'll notice I created a copy of your site in the sitebuilder so you could experiment with stuff without breaking your actual site. You can then see the results at www.kilrootrecfc.com/test (http://www.kilrootrecfc.com/test)
You can delete that test site anytime, or create other versions etc.
NB for what it's worth ... on a website I think sans serif fonts are easier to read. serif fonts like Times New Roman etc I find a bit fussy, especially in busy areas like those fixture tables. It's only a personal preference but if you've found an easy way to change the whle table it might be worth experimenting with that.
kilrootrec
24th January 2007, 02:08 AM
Well? Share with me! :saywha:
errmmm, right click on table, select all, then choose font! I knew my degree would come in handy one day!! :pcguru:
paul_r
24th January 2007, 09:27 AM
DOH! Once again, obvious once you see it. You can't beat a college education, huh?
kilrootrec
27th January 2007, 04:23 PM
Not sure exactly what's going on there but it appears that the sitebuilder will pick up the background colour css info ok, but not the font. I'm guessing that somehow the sitebuilder is over-riding the css info for fonts.
Paul,
Regarding the fonts, is there anyway of getting past sitebuilder overridding the fonts? I have added links and set them up under the kilroot.css, however they are still not picking up the fonts and are going from blue to white once visited.
paul_r
27th January 2007, 04:49 PM
I'll have a look and see if I can see what's doing that. I take it you're talking about the Results and Fixtures page? The links for the Reports?
There's a clue of some sort in the fact that the copy of the site I created for experimanting with stuff in your css doesn't have the same issue. See http://www.kilrootrecfc.com/test/page_10761.php
That's basically a copy of the site in a /test/ diectory. I remember I did something with the formatting in the test site and you can see I have a different font than you for example. Must have done something else too, or you've maybe changed something on the main site? What exactly did you mean when you say you set up links in the kilroot.css? For this page?
The Tables page looks really well now btw. Good colours (:whistling: ) and I see you got the dividing lines in too.
paul_r
27th January 2007, 05:01 PM
Right. Got it I think. I suspect we're both accessing the sitebuilder at the same time here as it keeps booting me, so I'll work from memory rather than relay what I'm doing.
This has to do with the stylesheets within sitebuilder. Your fixtures page is using the default stylesheet 'Plain', which for some stupid reason was set to format visited links to white. I've changed that now, so the visited links disappearing should now be fixed.
I'm still looking at some other stuff here so I'll post back in a few minutes when I've done that.
paul_r
27th January 2007, 05:30 PM
I'm not completely on top of the stylesheets but here's a reasonable start.
In sitebuilder go to the Fixtures page. Select the 'Edit layout' tab at the top. In that layout page you can select at the top somewhere which stylesheet to apply to the page.
To edit or create a new stylesheet you need to go to the left side navigation and click on the centre tab 'Style'. Down there you'll see the list of stylesheets. Click on one to edit it, or at the top left click 'New' then select stylesheet. Name it something suitable and set all the parameters the way you want them.
When you're editing stylesheets you can click on the top tab 'Usage' to see which pages/tables are using that stylesheet. It's important to think about that because when you change a stylesheet you may be changing several pages that are reading that.
When you go back to the Fixtures page you should be able to go to the Edit Layout tab and change to your new stylesheet and get the style you want that way.
At least ... that's how it's supposed to work I think. I'm having a bit of trouble getting it to do what it's told. That may because we're both in the sitebuilder at the same time and confusing it, you may have applied some formatting some other way I'm not aware of, or they may be a bug.
Or I'm being thick. Let's not rule that out yet.
paul_r
27th January 2007, 06:14 PM
The latter mostly :1 (58):
The bit I was struggling with was the column title bar. I somehow changed the background colour of the top one to blue (at least I think top and bottom tables both had grey title bars when I started). Couldn't figure out where or how to change that colour in the stylesheet.
Turns out it isn't changed in the stylesheet but in the 'Edit text' page - just click on the cell > click the table icon (beside the spell check button) and change the cell colour. The cell was set as transparent so I still don't know where it was picking up the blue from, but once I selected grey that sorted it. You need to change cells individually this way. Or change them globally by right clicking and 'Select all'.
To change fonts using the stylesheet ... go to the page you want to change > click anywhere in an area of text you want to change > note the Text Style in the toolbar (e.g. Marginless text) > go to the stylesheet and edit that particular text style. That should change all text on the site using that text style in that stylesheet. Remember my earlier warning to check the Usage tab to see what parts of the site are using that stylesheet.
The idea of stylesheets is that you can globally change fonts across the site without having to change sections individually. This can save a real headache if you want to change formatting. As you will generally want to use the same font across the majority of the site this is the way to do it.
Video tutorial on stylesheets here (http://webhelp.visport.co.uk/video.html#sitebuilder) - video 13.
kilrootrec
27th January 2007, 08:44 PM
holy sh*t you have been busy!!
I dont know how to break this to you but I was actually talking about the links on the 'links' page and not the fixtures/results page.
sorry :whistling:
paul_r
27th January 2007, 10:39 PM
Thankfully it didn't really matter what page I was using to find out how it worked. I hadn't used the stylesheets before so I was curious about what was possible/not possible with them. Like anything new it needs a bit of time clicking around and breaking stuff to find out.
Thought I may as well break your site as any other :wasntme:
The kilroot.css stylesheet was conflicting with the sitebuilder stylesheet somehow. Not sure exactly how, and since I got round it I don't really care now.
What I did was create a new stylesheet in sitebuilder (as outlined in previous post) and called it 'Links'. In fact I left it pretty much at the default settings it started with I think. May have edited the background colour from transparent to grey, but no more than that. The stylesheet includes settings for hover, normal and visited formats.
Then on the Links page > Edit layout tab I selected that new stylesheet from the dropdown, in place of 'Default'. That then applies the settings in that stylesheet to the Links php block you have in there.
Sorted. In theory you can change the format of hover and visited links in that 'Links' stylesheet, but I was struggling earlier to get it to do exactly what I wanted. Since I think the links look ok now I didn't push my luck :pcguru:
kilrootrec
28th January 2007, 11:28 AM
What can I say?? Good job, done well!! :yeahthat:
I had experimented with the stylesheets before but I was finding by changing one page it effected the rest of the site *usage*.
Links look top dollar now, thanks yet again Paul:1 (62):