From: Harris, G. <gar...@se...> - 2011-11-03 17:51:27
|
I created a folder in the web/services directory call "SEBTS_Pages". In that directory, I placed a file called ask_librarian.php in that directory. The file contains the following code: <?php require_once 'Action.php'; class EmailLibrarian extends Action { function launch() { global $interface; global $configArray; $interface->setPageTitle('Ask a Librarian'); $interface->setTemplate('ask_librarian.tpl'); // Do Something Here $interface->display('layout.tpl'); } } ?> I then went to web/interface/[theme]/ and created a folder called "SEBTS_Pages". I placed a file called ask_librarian.tpl in that directory. The file contains the following code: Hello World! I have two questions: 1) Have I set everything up correctly; 2) How do I call the page via URL? Gary From: Demian Katz [mailto:dem...@vi...] Sent: Wednesday, November 02, 2011 4:00 PM To: Harris, Gary; vuf...@li... Subject: RE: Ask a Librarian Page The big advantage to building your new page as a VuFind action is that it makes it easy to embed your action into the VuFind framework (i.e. keep the consistent header/footer/search box) without having to duplicate any logic. If you don't want your "ask a librarian" page to look like the rest of VuFind, then this isn't a significant benefit and building a stand-alone page would work just as well. Don't be too intimidated by Smarty - it's quite easy to work with. You just create HTML pages, and if you need to display variables from your PHP code, you use $interface->assign('variablename', value) in the PHP code and embed the data as {$variablename|escape} in the Smarty template (the |escape part is responsible for HTML entity encoding text). I don't think you'll find it too painful to create an email submission form with this technology. This wiki page may also help you get started: http://vufind.org/wiki/building_a_module Let us know if you need more help! - Demian From: Harris, Gary [mailto:gar...@se...] Sent: Wednesday, November 02, 2011 3:31 PM To: vuf...@li... Subject: [VuFind-General] Ask a Librarian Page We are going to code up an "Ask a Librarian" page that e-mails a question to our library reference desk. I'm trying to figure out the best way to go about this. I don't know whether to just code an independent PHP script to handle the whole thing or to try to use the Smarty templating system somehow. Smarty is completely new to me, so I would be starting from absolute scratch knowledge-wise if I went that route. I was wondering if anyone had recommendations. Thanks, Gary P.S. If you have some code that does a similar thing and you wouldn't mind sharing, that would be awesome. Thanks in advance. |