Including a PHP script

I’m trying to include a wiki script (PHP) into a page - no matter that I suffix the page .php and write the include correctly (I think?) the script will not show. Include used:

<?php include(doku.php); ?>

The only way I’ve found to do it that will work is to use an iFrame. But then, if a page of the wiki is long, I end up with two vertical scroll bars - nasty!

Is there any way to make an iFrame ‘bottomless’ so to speak?

Hugh


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Can you post a link to your page online Hugh - so we can see the underlying code.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi David,

Don’t have a link - testing it on a local MAMP installation.

I have actually made progress, and the PHP include is now working! However, there are CSS issues to resolve - the script uses CSS and there are umpteen CSS files. I’m having to link to these in the freeway document by adding s in the , but they seem to be dominating the Freeway styling, so there are obviously duplications going on. Somehow I need to subvert the script CSS to affect only the script part of the output freeway .php file…!

Hmm…

Hugh


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Again without seeing underlying code it is difficult to advise.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yeah, this is tricky stuff. Looking at your earlier question (for the benefit of future searchers) the answer was to quote the name of the file you were trying to include.

But the styling will take some patience and hand-work in the CSS files themselves. What you’ll need to do is remove (or move) any of the style rules that relate to the body, html, any tag name like p, h1, div, etc., and “scope” them to just the part of the page where you want those rules to apply. If you are including this blob of PHP-generated HTML inside a single DIV (HTML box) on your page, then this becomes easier: just prepend the ID of that DIV to the style rule’s selector (the part outside of the curly-braces).

//original rule
p {
	font-family: Verdana, sans-serif;
	font-size: 1.3em;
	color: #333;
}
//becomes:
#yourDiv p {
	… same ...
}

That leading ID becomes the switch that turns off the rule for everything except children of that particular DIV.

If you can create a test page (it doesn’t have to be PHP, just copy and paste the contents of View Source from your browser when you’re viewing the MAMP-hosted site) and post it somewhere, there are several of us on this list who are well-versed in reading source and making sense of it.

Walter

On Jun 22, 2012, at 8:28 AM, hugh wrote:

Hi David,

Don’t have a link - testing it on a local MAMP installation.

I have actually made progress, and the PHP include is now working! However, there are CSS issues to resolve - the script uses CSS and there are umpteen CSS files. I’m having to link to these in the freeway document by adding s in the , but they seem to be dominating the Freeway styling, so there are obviously duplications going on. Somehow I need to subvert the script CSS to affect only the script part of the output freeway .php file…!

Hmm…

Hugh


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Appreciate that, David, thanks for the interest.

Thinking about it… I’ve put the include between <div. tags - that’s how I got it to include, it wasn’t pulling the script in before. Maybe what I need to do is give the div and ID, and then somehow reference the script css files in that ID…? But I don’t know how you would write links to other css files within a css declaration?..

Hugh


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You can include a link to a CSS file anywhere in your page but load order will determine what is affected.

An example is going to be most helpful.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You can use the @include reference in CSS to load external CSS files from within a master CSS file, but the result would still clobber the whole page because of how CSS works. If you want the rules from that external file to only affect certain parts of the page, you’re going to have to rewrite those rules so they are more specific – so they can only apply to the part of the page where you want them to happen.

Your only other option (assuming you can’t rewrite the CSS) is to use an iframe to hold the external file and all of its CSS. That would “sandbox” the rules, since an iframe is like a window cut in your page through which you look at another (distant) page. The two cannot affect one another. But iframes cause their own set of problems, chief among which are unwanted scrollbars or fixed element height (page too tall).

Walter

On Jun 22, 2012, at 8:46 AM, hugh wrote:

Appreciate that, David, thanks for the interest.

Thinking about it… I’ve put the include between <div. tags - that’s how I got it to include, it wasn’t pulling the script in before. Maybe what I need to do is give the div and ID, and then somehow reference the script css files in that ID…? But I don’t know how you would write links to other css files within a css declaration?..

Hugh


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

David/Walt…thanks for your interest and ideas…hang fire and I’ll post some code up somewhere a.s.a.p.

cheers
Hugh


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

HugeDomains.com - freeway html output

HugeDomains.com - the viewed sourcecode


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

First problem I see here is that your included page is a complete HTML page, with its HEAD and BODY tags intact. That’s coming from the output of doku.php, so you have to start there. Cut down the template that generates that page so it is only the contents of the body tag, nothing else.

Second, related to the styles, you’re including the blueprint framework, which includes a mighty reset function that would probably stomp all over every style in your page. See if you can get rid of that particular stylesheet reference and see what happens then. Remember, you will have to fix the first problem before this second trick has any hope of working at all.

From what I see here, you are going to have better luck trying to style the DocuWiki template to look like the rest of your site rather than to embed the DocuWiki in your Freeway page. That is a hand-coding job to be sure, but it will be drastically simpler than trying to solve the puzzle you have currently set for yourself. The only other idea I have for you is an “eyebrow” frame over the top of the DokuWiki page, with navigation and branding back to your current site. That’s awful, because it kills any hope of URLs into the body of the DokuWiki site besides the home page.

Walter

On Jun 22, 2012, at 9:19 AM, hugh wrote:

http://codetidy.com/2986/freeway - freeway html output

http://codetidy.com/2987/freeway - the viewed sourcecode


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter,

Yes it’s tricky isn’t it! Do you know I even had a look at an old-fashioned frameset!..but couldn’t get the dokuwiki in the bottom frame to ‘center’ horizontally like the rest of the site (and the masthead stuff that was in the top frame)…

Back to the include - I do see the problem, and it may be beyond me to hack templates, although I’ll give it a bash. I don’t know what the design of this particular dokuwiki template (there are many) was doing with all the css files…it’s a nightmare. I think he must have been a css fan or something. Way overcomplicated. As far as I’m aware Blueprint is some Google css function?..

I have actually tried one of your other suggestions - which was to include my masthead stuff into the dokuwiki template. And I kind of got halfway there - I made the masthead image appear, and also the navigation links; but they were completely unstyled and I couldn’t work out how to connect them with their CSS styles!

But if including the script into the html file is beset with problems, I might go back and work harder on including the masthead html in the dokuwiki template. You’ve probably noticed that the masthead/navigation stuff references its own CSS files - whichever way I turn I’m surrounded by CSS issues!

The iFrame route certainly worked ok, but I’d have lost all searchability in most probability, and ended up with scrollbars within scrollbars…not nice.

Hugh


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walter/David…just an update:

I followed your advice, Walter, and went back to including the masthead/naviggation stuff into the dokuwiki template file. Stripped back my Freeway html to the very basics, even getting rid of all table tags and such, so it was very bare bones. That seemed to do the trick, provided I moved my Resources and Smoothemenu folders (the latter having CSS and Javascript for the menu system) away from the template folder and into the root folder of the script.

Two problems remained:

  1. The whole page was aligned left in the browser and didn’t match the centred site I run. After hours of looking I found a body css margin selector and changed it from 0px to auto… problem solved!
  2. The dropdowns on my menu system don’t work, only top level links. I can’t fathom this and think it’s a javascript problem, either a conflict with something in dokuwiki OR a problem with javascript on MAMP?..

However, a giant leap forward! Thanks for your suggestions.

Hugh


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Glad you have made progress but a live link would help with the last steps.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I will try and put something up live soemwhere, David, as I say really just trying this locally on MAMP at the moment.

Hugh


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options