Jump to content

shazam

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

shazam's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. cj, There are two things you need to do to make this work: [list] [*]Create the html data [*]Pass special header information & html page to the mail function you are using [/list] The html data can be contained in a variable.  Example: [code] <?php $to = "email address"; $subject = "subject"; $html_out = <<<END <p>the results of your form submission:</p> <ul>   <li>Form Variable 1: $formvar1</li>   <li>Form Variable 2: $formvar2</li>   <li>Form Variable 3: $formvar3</li>   <li>Form Variable 4: $formvar4</li> </u> END; ?> [/code] Then set your header information [code] <?php $header = "MIME-Version: 1.0\r\n"; $header .= "Content-type: text/html; charset=iso-8859-1\r\n"; ?> [/code] and send your message: [code] <?php mail($to, $subject, $html_out, $header); ?> [/code] Hope this helps. - B
  2. Ben, What is your ultimate goal with the table?  Is it to make querying easier for the application that uses it?  Your new table doesn't seem to be scalable (like Barand says, what if a Doctor has 4 addresses). If I understand more about how your application is supposed to use this data, I may be able to provide some suggestions around design of the database. - B
  3. Here is one thought... Double check your php.ini to ensure the 'post_max_size' directive is set to a large enough size. - B
  4. Hello, I have been playing around with DB_DataObject_FormBuilder for the past few days & am getting pretty far with it. Recently, I added in the capability to create automatic hierselects by following instructions on: [url=http://pear.reversefold.com/dokuwiki/doku.php?id=pear:db_dataobject_formbuilder:beyond_advanced#creating_automatic_hierselects]http://pear.reversefold.com/dokuwiki/doku.php?id=pear:db_dataobject_formbuilder:beyond_advanced#creating_automatic_hierselects [/url] Works great, however, I am running into a few issues: [list] [*]I'd like to be able to control the format of the hierselect fields with an external stylesheet. [*]I'd like to use selectAddEmpty & linkNewValue properties for each of the select boxes created by hierselect [/list] [b]For my first issue[/b], I have tried: [code]$formbuilder->elementTypeAttributes = array('hierselect'  => array('class' => 'form'));[/code] In my main script as well as: [code]var $fb_elementTypeAttributes = array('hierselect'  => array('class' => 'form')); [/code] In my DataObjects_<TableName> class (i.e. the primary table class generating the form). Neither seems to work. This methodology seems to work well with all other element types. I am able to get the results I want by modifying the args sent to QuickForm's createElement method: [code]$hierselect =& HTML_QuickForm::createElement('hierselect', $fb->getFieldName($virtualfield), $desc,'class=form','<br />'); [/code] I would, however, prefer to approach this in the same manner as other elements (i.e. via elementTypeAttributes). [b]On my second issue[/b], I am having no luck setting the selectAddEmpty and linkNewValue.  The select fields render with values from the database, but with no values set with selectAddEmptyLabel or linkNewValueText.  This does work find w/ standard select elements. Here is an example of some of the code I am using in my DataObjects_<TableName> class: [code] <?php var $fb_selectAddEmpty  = array (   'make','model','classification','po_vendor',   'depr_type','status','glcode','bu','location' ); var $fb_selectAddEmptyLabel = "-- Select --"; var $fb_linkNewValue    = array(   'make','model','classification','po_vendor',   'glcode','bu','location' ); var $fb_linkNewValueText = "-- Add New --"; var $fb_linkDisplayLevel = "2"; //used for preGenerateForm() and table() methods     var $conditionalFields = array(       'classification' => array(         'calss1:ref_class1' => array('id'),         'class2:ref_class2' => array('parent', 'id')       )     ); ?> [/code] Perhaps I am missing some very simple concepts. Any pointers are appreciated. Thx. - B
  5. Hello, I have been playing around with the PEAR HTML_QuickForm & DB_DataObject_FormBuilder packages. While I figured out how to extend the QuickForm Default renderer to meet my needs, I am having trouble figuring out how to do the same with FormBuilder. Here is an example of working code w/ QuickForm (hacked together from many examples on the web): [code] <link rel="stylesheet" type="text/css" href="/style/style.css"> <?php require_once "HTML/QuickForm.php"; require_once "HTML/QuickForm/Renderer/Default.php"; class CSSRender extends HTML_QuickForm_Renderer_Default { var $_headerTemplate = "<tr class=form>                           <th class=form colspan=\"2\" scope=\"row\">   {header}   </th> </tr>"; var $_elementTemplate = "<tr class=\"form\">                           <td class=\"form\" id=\"label\">     {label}     <!-- BEGIN required -->       <span class=\"required\">*</span>     <!-- END required -->   </td>   <td class=\"form\">     <!-- BEGIN error -->   <span class=\"error\">{error}</span><br /> <!-- END error -->   {element} </td>   </tr>"; var $_formTemplate = "<form class=\"form\" {attributes}>                         {hidden} <table class=\"form\">   {content} </table>   </form>"; var $_requiredNoteTemplate = "<tr>                                 <td class=\"form\"></td> <td class=\"form\">{requiredNote}</td>   </tr>"; } $form = new HTML_QuickForm('simple_test', 'get'); $renderer = new CSSRender(); $form->addElement('header', 'head', 'Contact Information','class=form'); $form->addElement('text', 'name', 'Name','class=form'); $form->addElement('text', 'phone', 'Phone','class=form'); $buttons[] = &HTML_QuickForm::createElement('reset', 'btnClear', 'Clear'); $buttons[] = &HTML_QuickForm::createElement('submit', 'btnSubmit', 'Submit'); $form->addGroup($buttons, null, null, '&nbsp;'); $form->addRule('name', 'Name required', 'required', '', 'client'); $form->addRule('phone', 'Phone number required', 'required', '', 'client'); if ($form->validate()) {   # If the form validates then freeze the data   $form->freeze(); } $form->accept($renderer); echo $renderer->toHtml(); ?> [/code] Essentially, I can use the same Renderer w/ FormBuilder, but I cannot figure out how to convert the following QuickForm code to FormBuilder (the key being the 'class=form' option for addElement): [code] $form->addElement('header', 'head', 'Contact Information','class=form'); $form->addElement('text', 'name', 'Name','class=form'); $form->addElement('text', 'phone', 'Phone','class=form'); [/code] FormBuilder, of course, auto-generates the form elements from database tables.  I suppose I need to find a way to modify how FB creates the elements... Any ideas or examples on how to do this? Thanks! - B
  6. FYI.  You may want to try playing wit a few of these functions as well: [code] snmp_set_oid_numeric_print(1); snmp_set_quick_print(TRUE); snmp_set_enum_print(TRUE); snmp_set_valueretrieval(SNMP_VALUE_PLAIN); [/code] - Brian
  7. Try creating a C:\usr\mibs directory & copying all mibs there.  I believe that is where the underlying libraries are looking for the mib files.  This has worked for me in the past.
  8. Hello, I've just installed (manual via zip file) PHP 5.2.0 on my Windows XP laptop & wanted to test a little code snippet to get a remote system's ip information.  It seems, however, that the install is using UCD libraries instead of NetSNMP as determined by the lack of support for a few functions (example: snmp_set_quick_print(TRUE)) and confirmed by the output of phpinfo(): [code] snmp UCD-SNMP Support => enabled UCD-SNMP Version => ucd-snmp-4.2.3 [/code] I have Net-SNMP 5.3.0.1 installed on my system.  Any ideas on how I can coax php to use NetSNMP libraries instead of UCD?  Of course, I've never had this problem compiling PHP from scratch on linux... Any pointers are appreciated! - Brian
  9. Well, I guess I didn't google hard enough... According to the manual: [code] Note: Parent constructors are not called implicitly if the child class defines a constructor. In order to run a parent constructor, a call to parent::__construct() within the child constructor is required. [/code] So I added parent::Asset(); to the child's constructor: [code]  function AssetConfig() {    parent::Asset();  } [/code] Everything is woking well now.  Sorry for the spam. - Brian
  10. Thanks thedarkwinter, I was thinking of that.  But I was under the impression that by extending a class, you automatically have access to all methods of the parent.  Perhaps there is another step necessary to initialize the parent class' constructor? - Brian
  11. Hell All, I should probably start by saying I am a PHP hack at best and very new to OO programming. Anyhow, I am trying to write a class that extends an existing class.  The original class seems to work fine on it's own but I get the following error in my apache log file when trying to access a class that extends it (of course, the script fails): [code] [Sun Oct 01 21:30:34 2006] [error] [client ***] PHP Fatal error:  Call to a member function getRow() on a non-object in C:\\***\\***\\***\\includes\\Asset.class on line 180, referer: http://***/***/asset.php?action=new [/code] [b]Environment:[/b] [list] [*]Windows XP [*]Apache 2.0.55 [*]PHP 5.1.1 [/list] Here is the code I am using to access the extended class: [code] $server        = new AssetConfig(); $asset_data = $server->GetAssetData($asset_id); [/code] Here is the code of the extended class: [code] <?php require_once 'Asset.class'; require_once 'Template.class'; require_once 'variables.inc'; class AssetConfig extends Asset {   var $asset_data;     function AssetConfig() {   }     function GetAssetData($id) {         $this->asset_data = GetAssetDetail($id);         return $this->asset_data;       } } ?> [/code] Here is the code of the parent class (relevant parts only): [code] <?php class Asset {   var $dsn;   var $db;   var $id;   var $result;   var $duplicate;     function Asset() {         $this->dsn = $GLOBALS[dsn];         $this->db =& DB::connect($this->dsn);         if (PEAR::isError($this->db)) { die($this->db->getMessage()); }       }   function GetAssetDetail($id) {     $query = "SELECT                asset_status.status_name AS asset_status,                asset_type.type_name AS asset_type,                location.location_name AS asset_location,                asset.asset_serialnum AS asset_serialnum,                asset.asset_assettag AS asset_assettag,                asset_po.po_number AS asset_po,                environment.environment_name AS asset_environment,                asset.asset_snmp AS asset_snmp,                asset.asset_name AS asset_name              FROM                asset              INNER JOIN                asset_status              ON                asset.asset_status=asset_status.status_id              INNER JOIN                asset_type              ON                asset.asset_type=asset_type.type_id              INNER JOIN                location              ON                asset.asset_location=location.location_id              INNER JOIN                environment              ON                asset.asset_environment=environment.environment_id              INNER JOIN                asset_po              ON                asset.asset_po=asset_po.po_id              WHERE                asset.asset_id=$id";       $this->result =& $this->db->getRow($query, array(), DB_FETCHMODE_ASSOC); // <-- This is line 180       if (PEAR::isError($this->result)) { die($this->result->getMessage()); }       return $this->result;   } } ?> [/code] It seems that the object $this->db is not being created by the constructor 'Asset' when accessd by my AssetConfig class. I've been googling & banging my head for some time.  Can anyone point me into the right direction? Thanks! - Brian
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.