Forums | Mahara Community
Open Discussion
/
Managing External Pages via a CMS like Typo3, Wordpress ...
26 June 2009, 12:59
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? :)
Many thanks in advance!
BR, Peer
26 June 2009, 22:52
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.
28 June 2009, 5:12
Hi Nigel,
thanks for your reply.
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
29 June 2009, 5:26
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
29 June 2009, 8:16
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
29 June 2009, 20:11
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.
08 July 2009, 10:25
Hi Nigel,
thanks for your reply.
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/)
Many thanks in advance!
BR, Peer
08 July 2009, 11:52
Followup:
Meanwhile I tried this ...
<?php
include 'HttpClient.class.php';
$client = new HttpClient('www.mydomain.tld');
$client->post('/dont_know1.php', array(
'username' => 'examplename',
'password' => 'examplepassword'
));
if (!$client->get('/dont_know2.php')) {
die('An error occurred: '.$client->getError());
}
$pageContents = $client->getContent();
?>
Download of "HttpClient.class.php" file here ... http://www.wappler.eu/php-httpclient/
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
12 July 2009, 15:35
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.
20 July 2009, 10:04
Hi Nigel,
thanks for your reply.
However I don't get it work :(
BR, Peer