Hi, The one thing keeping me from diving into Drupal (and I have been searching around for info) is:
Can I use the tools it provides (like login and templates etc.) to create a 'section' on a website where my own PHP code runs a mini-application like a shopping-basket (browse, filter, add, view, checkout) or something like a track-a-parcel system and so on? In other words, a PHP controlled set of pages which uses a db and forms across many pages - the sort of thing that gets custom written for a particular client.
If I can 'drop in' such custom extensions to Drupal and have it do the theming and login control etc. then it makes sense to go with Drupal.
If I have to place a link "click here to track your orders" (for example) and that link goes to another folder (call it an "external" site) where my PHP system runs and I must fake the look of the main website (which was under Drupal control) for this new area, as well as implement a new login of some kind -- then I may as well do everything in PHP.
Thanks, \d
* Donn [19/02/08 08:13]:
Can I use the tools it provides (like login and templates etc.) to create a 'section' on a website where my own PHP code runs a mini-application like a shopping-basket (browse, filter, add, view, checkout) or something like a track-a-parcel system and so on?
I guess you can do it, I'm doing it at a much simpler level, but I don't see why you can do it combining your code, drupal theming and features and your external database.
Here is my example:
I use db_set_active to change to another db, perform the queries, then go back to drupal to use its theming capabilities and rest. Here is an example where I query another db and then create a table in drupal, paged and sortable. You can define multiple databases in settings.php, look at http://drupal.org/node/18429.
Here is an example, I enter this direcly into a content type where I allow php in the body only to the admin. "ampa" is a table in an external database:
<?php
db_set_active('ampa');
$sqlCount = "SELECT COUNT(*) FROM ampa";
$header = array( array('data' => 'Nom', 'field' => 'nom'), array('data' => 'Centre', 'field' => 'centre'), array('data' => 'Població', 'field' => 'poblacio','sort' => 'asc'), array('data' => 'Comarca', 'field' => 'comarca') );
$sql = "SELECT * FROM ampa"; $sql .= tablesort_sql($header);
$ta = array('id' => 'my-table', 'align' => 'center');
$result = pager_query($sql, 30, 0, $sqlCount);
$trows = array(); while ($row = db_fetch_object($result)) { $trows[] = array( array('data'=>$row->nom,'valign'=>'top'), array('data'=>$row->centre,'valign'=>'top'), array('data'=>$row->poblacio,'valign'=>'top'), array('data'=>$row->comarca,'valign'=>'top') ); }
db_set_active('default');
$output = theme('table', $header, $trows,$ta); $output .= theme('pager', NULL, 30, 0);
print $output;
?>
Thanks for your feedback Walter,
I should have said that I have not yet used Drupal, but I get the impression that it has many ways to display elements and it's a matter of learning the way it does things.
To anyone on the list:
To further clarify: I would need to code a system that: 1. Allows only logged-in users to access a custom 'content type'. i.e. prompt for login when not logged-in. 2. Have many 'pages' within that 'content type' that provide the back and forth flow of things like shopping systems.
On point 2, there are two approaches: a) Many PHP files, each doing a certain thing: login.php, showproducts.php, basket.php, errors.php, etc. Where each one would hook-into Drupal's way of showing forms and theming. b) One PHP file that handles all of that using a switch or if-then-else mechanism so that it shows various 'faces' according to the results of GET/POST/COOKIES and so forth.
What's the best approach?
I suppose I could create an iframe (ugh!) content-type the content of which is my own system served from some other directory entirely - That would mean minimal css to maintain the look, but leave the Drupal home website on all surrounding sides.
\d
Quoting Donn donn.ingle@gmail.com:
Thanks for your feedback Walter,
I should have said that I have not yet used Drupal, but I get the impression that it has many ways to display elements and it's a matter of learning the way it does things.
To anyone on the list:
To further clarify: I would need to code a system that:
- Allows only logged-in users to access a custom 'content type'.
i.e. prompt for login when not logged-in. 2. Have many 'pages' within that 'content type' that provide the back and forth flow of things like shopping systems.
Check the modules at http://drupal.org/project/Modules
On point 2, there are two approaches: a) Many PHP files, each doing a certain thing: login.php, showproducts.php, basket.php, errors.php, etc. Where each one would hook-into Drupal's way of showing forms and theming. b) One PHP file that handles all of that using a switch or if-then-else mechanism so that it shows various 'faces' according to the results of GET/POST/COOKIES and so forth.
Check the documentation at http://drupal.org/handbooks
What's the best approach?
I suppose I could create an iframe (ugh!) content-type the content of which is my own system served from some other directory entirely - That would mean minimal css to maintain the look, but leave the Drupal home website on all surrounding sides.
Once you've reviewed the documentation and modules come back with more questions. I suggest the Ubercart module for eCommerce, others will have more to say about other eCommerce modules.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Quoting Donn donn.ingle@gmail.com:
Hi, The one thing keeping me from diving into Drupal (and I have been searching around for info) is:
Can I use the tools it provides (like login and templates etc.) to create a 'section' on a website where my own PHP code runs a mini-application like a shopping-basket (browse, filter, add, view, checkout) or something like a track-a-parcel system and so on? In other words, a PHP controlled set of pages which uses a db and forms across many pages - the sort of thing that gets custom written for a particular client.
You mean something like http://drupal.org/node/32178?
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
You mean something like http://drupal.org/node/32178?
Thanks Earnie, that looks informative. I will read around.
\d