• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 48
  • Last Modified:

Integrating a PHP application into a predefined template

Hi,

I am trying to integrate a PHP application into my own template, without having to use iFrame. I have tried to do it by using <?php include .. ?>, but it does not work.

The template can be seen here: https://kroweb.dk/gfdev/template_masters/gf_index_bare_sidebar.php 
And the application can be seen here: https://kroweb.dk/WT_test/index.php?ctype=gedcom&ged=ptest

If anybody have some ideas to how this can be done, I would be very interested.
0
Peter Kroman
Asked:
Peter Kroman
  • 5
  • 3
  • 2
2 Solutions
 
Olaf DoschkeSoftware DeveloperCommented:
Well, you need to strip off the HTML skeleton the PHP script generates so it only contributes the inner HTML, perhaps all in a single div id=cntent or new HTML5 content tag. Then the include idea can work out.

But you can't have a full HTML output within an HTML, other than an iframe. So change the PHP application with a parameterization to work standalone (with HTML skeleton) or embedded (just outputting a div/content tag). It is harder, than it sounds, as most of the content surely depends on loaded JS, CSS and other header parts you can't have in embedded mode, at least not as simple as referring to a css class. But if that all is static it's easily moved into your outer template.

The next hard problem is links, In the end, it may be easier to turn it around and incorporate your outer template into the application template.

Bye, Olaf.
0
 
Peter KromanSenior Proposal SpecialistAuthor Commented:
Thanks Olaf,

Sounds difficult :) Could a template engine - like for example twig - be used for something like this?
0
 
Olaf DoschkeSoftware DeveloperCommented:
Whatever the application is using now should be easiest to also use and adapt. In the end it might be as simple as adding some meta tags to load further css and js and adding the HTML of your template to the HTML already existing, while putting mainly only its body into a div tag.

It's extremely hard to say whether it's simple or not just by looking at both HTML output, how it's put together is of interest and you have the better insight.

If you don't want to go about this, then iframe is an option. Why avoid it? Because frames are bad? Well, we're in the age of HTML5 and frames got reconsidered for some purposes. Especially in this case, as bringing everything together in one single HTML page/template is hard from both sides, it is a solution.

Bye, Olaf.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Peter KromanSenior Proposal SpecialistAuthor Commented:
Well - I don't actually mind using iFrames, but when doing so I miss the permalinks that the application is generating. These links are important tools to navigate in the application it self and to use as links that can be distributed.

Is there a way to display those links in the URL line when using iFrame?
0
 
Julian HansenCommented:
To be clear - you want to apply the template to your application?

The usual practice is to take the template and swap out the different areas with your code that generates your content. If you are looking for a magical way for them to merge it is not going to happen.

Let's take a look at the templates navigation contained in the <nav> section you can take the contents of the <nav> section and copy them to the <nav> in the template
BUT
You are gong to be bringing across the classes from the application - which may not slot in with the classes of the template. Therefore you are going to have to modify the incoming HTML to match the classes in the template if you want the styling to hold.

From what I can see it is a manual cut, paste, edit process that you need to do to move to the template look and feel.
0
 
Peter KromanSenior Proposal SpecialistAuthor Commented:
Thanks Julian,

Yes - that's what would like to do. I am not looking for something magical :) I am just asking what is possible.

And I think I have got my answer. I need to merge the application and the template. But I really don't want to mess around too much with the application which comes from a third party. So I think I'll just levae it for now and keep on using iFrame - and if it is not possible to display the applications permalinks using iFrame so be it :)
0
 
Julian HansenCommented:
@Peter,
Template merging is a very common practice. Templates are purchased online and then used to style wire-framed (or existing) sites using the process I described above.

You don't end up breaking the existing application - you create a new (test) page using the template as a starting point.
You then bring the sections across from the application one at a time.

It helps to think of your page made up of a number of dedicated components that each perform a specific task. Example
* Navigation component
* Pedigree of Private
* Slide Show
* On This day
* Statistics - Peter Test

Think of each of this as a stand alone entity. This makes moving them about much easier.

Bring the component across to the template page and manually adjust for styles and element generation (for instance if you are using a <ul> in the application but the template uses <div>'s - you would potentially need to change one into the other)

Because it is a test page you can experiment without impacting the live page. When it has all been brought across you can publish the new page being sure to setup a regression script that allows you to revert to the previous version in the event of something going wrong.
1
 
Peter KromanSenior Proposal SpecialistAuthor Commented:
OK . That is actually how I do it - and have done it - with all my other pages which works nicely.

I have not tried working moving the entities of the application one by one, but just the whole application.

I'll go to work on your suggestion. Thanks :)
0
 
Olaf DoschkeSoftware DeveloperCommented:
I see you got your answer.

Subclassing would be nice, wouldn't it? That's a thing missing in HTML/CSS. In your position I would keep a copy of original templates and merge as sensible as you can do. In the end it looks like you'd like to move the whole HTML of the application into one div of your template and that means putting in the body part of the app HTML into your content section div.

But the head section will have much of the includes of CSS and JS for the application to work, too. In the end merging both UI and functionality. You better adapt your template to use same versions of jQuery or other common things before merging.

Bye, Olaf.
0
 
Peter KromanSenior Proposal SpecialistAuthor Commented:
Thanks Olaf,

I have worked with it, and I have to admit that his application is too complex for me to get working with my template. So I think I'll just keep it the "iFrame way" for now. Thanks for the answers to Julian and Olaf.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now