Forums | Mahara Community

Open Discussion / Managing External Pages via a CMS like Typo3, Wordpress ...

Deleted user
Posts: 73

26 June 2009, 12:59 PM

Hi all,

in order to create external pages, that would describe the whole background of a given Mahara-site (like homepage (not being logged in), help pages, a.s.o.,) , I would like to use a common Content Management System like Typo3 (www.typo3.org) or Wordpress (www.wordpress.org). Cause these CMS are a bit more comfortable and supports a lot of already developed extensions/plug-ins.

From a non-developer's point of view, a "simple" way might be that the (root-)index.php file would be handled by the CMS, e.g. Typo3, and the underlying Typo3-template would integrate/reference the login/authentication plugin of Mahara. So, in case a user logs into the system by filling out the login fields and pressing the send button the Logged-in-page of Mahara would be loaded and all consequent user action is managed by Mahara. However, in case the user is not logged in Typo3 would handle all user requests.

Has anyone already solved this kind of problem? Any other creative ideas? :)

BR, Peer

Deleted user
Posts: 1643
Re: Managing External Pages via a CMS like Typo3, Wordpress ...

26 June 2009, 10:52 PM

Hi - that sounds like it would work ok, Mahara's index.php is not particularly important right now.

You'd have to make sure that when you made the login form, you included the hidden element that Pieforms looks for to see if the form has been submitted. You can look at the existing login form for that.

In future, if the index page does become more important, you might have to think about some other solution, but for now it should probably work.

Deleted user
Posts: 73
Re: Managing External Pages via a CMS like Typo3, Wordpress ...

28 June 2009, 5:12 AM

Hi Nigel,

Is there any isolated PHP-snippet/-file that is responsible for the Mahara user login?
If so, I would test to include this external php code into Typo3?

Background is that I have found this extension in the Typo3 Extension Repository ...
http://typo3.org/documentation/document-library/extension-manuals/lumophpinclude/1.2.0/view/

Do you think that this could work?

BR, Peer

Deleted user
Posts: 1643
Re: Managing External Pages via a CMS like Typo3, Wordpress ...

29 June 2009, 5:26 AM

You don't need to grab the Mahara code out for this - and that won't work anyway as all of Maharas code relies on the Mahara functions etc. being available.

Better to just make a form that submits to Mahara and let Mahara handle the details

Deleted user
Posts: 73
Re: Managing External Pages via a CMS like Typo3, Wordpress ...

29 June 2009, 8:16 AM

Ok, it wouldn't be the problem to implement a login form as content element within Typo3.

However, how should I tell Typo3 (Wordpress a.s.o.) to send the information to Mahara?
Do I have to include any Mahara definitions or to call any Mahara funtions?

I would install Typo3 in the document root - so that Typo3 would be the master of the index.php - and Mahara in a subfolder, e.g "mahara". Right?

BR, Peer

Deleted user
Posts: 1643
Re: Managing External Pages via a CMS like Typo3, Wordpress ...

29 June 2009, 8:11 PM

Your login form could just POST to the mahara homepage. That would send the information there.

You could add code into the homepage to redirect back to typo3 afterwards if you needed that.

Deleted user
Posts: 73
Re: Managing External Pages via a CMS like Typo3, Wordpress ...

08 July 2009, 10:25 AM

Hi Nigel,

Regarding this issue I had an extensive talk with Google ;) ...
Best result is the following link with some HttpClient examples ... http://scripts.incutio.com/httpclient/examples.php

Could you please give me a short hint which of these examples would be best suited in order to login to Mahara from another site? (I guess the static link would be http://www.mydomain.tld/)

BR, Peer

Deleted user
Posts: 73
Re: Managing External Pages via a CMS like Typo3, Wordpress ...

08 July 2009, 11:52 AM

Followup:

Meanwhile I tried this ...

<?php

include 'HttpClient.class.php';

$client = new HttpClient('www.mydomain.tld');$client->post('/dont_know1.php', array(
));

if (!$client->get('/dont_know2.php')) { die('An error occurred: '.$client->getError());
}

$pageContents =$client->getContent();

?>

It didn't work. Maybe due to the fact that I don't know which php-files to reference in the above mentioned php script. Which php files do I have to take for the above placeholders "dont_know1.php" and "dont_know2.php"?

BR, Peer

Deleted user
Posts: 1643
Re: Managing External Pages via a CMS like Typo3, Wordpress ...

12 July 2009, 3:35 PM

Hi,

You could do something like that I suppose. Mahara has an inbuilt function for doing http requests, it's called mahara_http_request and it's in lib/web.php somewhere around like 2565.

You would need to post to any page, with the parameters login_username, login_password (their values are obvious), and also pieform_login=''. You can examine the resulting page to see if it worked - e.g. if the login form is still present then the attempt failed.

Deleted user
Posts: 73
Re: Managing External Pages via a CMS like Typo3, Wordpress ...

20 July 2009, 10:04 AM

Hi Nigel,