Jump to content

RopeADope

Members
  • Posts

    157
  • Joined

  • Last visited

Posts posted by RopeADope

  1. Yep.  I added the overflow hidden to the widgets which serves the purpose of housing the widget content.  The left and right divs only have widgets as content though, so I'm not sure if its necessary to add the overflow:hidden to those (#left and #right).

  2. Read the article.  I have better understanding now.  However, my previous question remains...  My #left and #right divs serve as containers for multiple .widgets and none of these have heights set.  The #left and #right divs aren't meant to be seen anyway but it seems like bad practice to leave them as they are.  Any thoughts?

  3. No, I forgot initially.  Just added the overflow:hidden; and that fixed the .widget size.  Now I have a #left div which is supposed to hold several .widgets so should I change the overflow to hidden on that so all the .widgets can inherit that property?  Or is that a bad idea?

  4. apart from that, if you don't set a height on the widget the height of it will be 0. if you set it to overflow:hidden; it will shrinkwrap around the inner contents. you can find something about that on my blog if interested. anyway an online example for css and html is often more useful.

     

    What confuses me is that I've already tried just filling it with text to check the behavior, and it grows and shrinks as needed.  Its just the table that winds up below the widget.  Here's the source.

          <div id="left">
    
             <div class="widget">
    
                <form method="post" action="/php/process_data.php">
    
                <input type="hidden" name="table_name" value="timesheets" />
    
                <table>
    
                <tr>
    
    	            <th>Timesheets</th>
    
                </tr>
    
                <tr>
    
                   <td>Employee:</td>
    
                   <td>
    
                      <select name="employee">
    
                         <option>Chad Scribner</option><option>Mark Tuttle</option>	                  </select>
    
                   </td>
    
                </tr>
    
                <tr>
    
    	            <td>Date</td><td><input type="text" name="date" title="YYYY/MM/DD" /></td>
    
    	         <tr>
    
    	            <td>Activity</td>
    
    	            <td>
    
    		            <select name="activity">
    
    			            <option>Maintenance</option>
    
    			            <option>Break/Fix</option>
    
    			            <option>Admin</option>
    
    			            <option>Service Request</option>
    
    			            <option>Training</option>
    
    		            </select>
    
    	            </td>
    
    	         </tr>
    
    	         <tr>
    
    	            <td>Hours</td>
    
    	            <td>
    
    	               <select name="hours">
    
    	                  <option>1</option><option>1.25</option><option>1.5</option><option>1.75</option><option>2</option><option>2.25</option><option>2.5</option><option>2.75</option><option>3</option><option>3.25</option><option>3.5</option><option>3.75</option><option>4</option><option>4.25</option><option>4.5</option><option>4.75</option><option>5</option><option>5.25</option><option>5.5</option><option>5.75</option><option>6</option><option>6.25</option><option>6.5</option><option>6.75</option><option>7</option><option>7.25</option><option>7.5</option><option>7.75</option><option>8</option>		               </select>
    
    	            </td>
    
                </tr>
    
                <tr>
    
    	            <td>Description:</td><td><textarea name="description"></textarea></td>
    
                </tr>
    
                <tr>
    
    	            <td>Comments:</td><td><textarea name="comments"></textarea></td>
    
                </tr>
    
                <tr>
    
    	            <td><input type="submit" value="Submit" /></td>
    
                </tr>
    
                </table>
    
                </form>
    
             </div>
    
          </div>
    
          <div id="right">
    
          </div>
    
    

  5. Hi all.  I'm attempting to put a table within a "widget" div but for some reason the table is displaying below it.  Here's the pertinent code.

     

    The left and right divs act as columns and the widget class just acts as a separator for inside of the left and right divs.

    #left{
       float:left;
       width:46%;
       margin-left:1%;
    }
    #right{
       float:right;
       width:46%;
       margin-right:1%;
    }
    .widget{
       border-top:blue solid 3px;
       background-color:#fff;
       padding:0.5em;
       margin:0.5em;
    }
    table{
       float:left;
       margin:0.75em;
       background-color:#ccc;
       border:#999 solid 1px;
       border-radius:10px;
       padding:5px;
       box-shadow:10px 10px 5px #888;
    }
    

     

    The page.

          <div id="left">
             <div class="widget">
                <form method="post" action="process_data.php">
                <input type="hidden" name="table_name" value="timesheets" />
                <table>
                <tr>
    	            <th>Timesheets</th>
                </tr>
                <tr>
                   <td>Employee:</td>
                   <td>
                      <select name="employee">
                         <?php
                               connect_mysql("localhost","root","Cscr!114","test");
                               $sql="SELECT first_name,last_name FROM employees";
                               $result=mysql_query($sql);
                               $i=0;
                               while($row=mysql_fetch_row($result)){
                                  echo "<option>" . $row[0] . " " . $row[1] . "</option>";
                                  $i++;
                                  }
                         ?>
                      </select>
                   </td>
                </tr>
                <tr>
    	            <td>Date</td><td><input type="text" name="date" title="YYYY/MM/DD" /></td>
    	         <tr>
    	            <td>Activity</td>
    	            <td>
    		            <select name="activity">
    			            <option>Maintenance</option>
    			            <option>Break/Fix</option>
    			            <option>Admin</option>
    			            <option>Service Request</option>
    			            <option>Training</option>
    		            </select>
    	            </td>
    	         </tr>
    	         <tr>
    	            <td>Hours</td>
    	            <td>
    	               <select name="hours">
    	                  <?php
                               $i=1;
                               while($i<={
                                  echo "<option>" . $i . "</option>";
                                  $i+=0.25;
                                  }
    	                  ?>
    	               </select>
    	            </td>
                </tr>
                <tr>
    	            <td>Description</td><td><input type="text" name="description" /></td>
                </tr>
                <tr>
    	            <td><input type="submit" value="Submit" /></td>
                </tr>
                </table>
                </form>
             </div>
          </div>
          <div id="right">
          </div>
    

  6. Ok so here's what I tried...

     

    The line

    echo "<tr><td>" . $__TEXT__[$fields->name] /*ucwords(preg_replace("/_/"," ",$fields->name))*/ . "</td><td style=\"padding:3px;\"><textarea style=\"width:98%;height:50px;resize:none;\" name=\"" . $fields->name . "\" /></textarea></td></tr>";

     

    en.php

    $__TEXT__=array
    (
       'strategy'=>"Strategy",
       'Comments'=>"Comments"
    );

     

    It doesn't print out anything though.  I also tried it with the table name in the function $__TEXT__[$table_name] but it didn't print anything out.

  7. It just seems like you need to rework the patterns. As with "bus_it_requests", you'll need to run all the patterns which start with "bus" before the "/bus/" pattern. For example, it looks like you have patterns like "bus_service" and "bus_financial". Those need to be moved.

     

    Right.  I also think that maybe reworking the file naming convention may make this easier as well.  The convention is [parent module]_[child module]_[type].  So bus_financial_mgmt_sop.pdf needs to be displayed as "Business Management - Financial Management - SOP".  So if bus_financial_mgmt_sop.pdf was renamed to bus_mgmt_financial_mgmt_sop.pdf I'd just have to match "/bus_mgmt/","_financial_mgmt","_sop".  I'll work on this today and post my solution.

  8. Did you see Reply #7 about the underscore pattern?

     

    No, I missed that.  Its still doing the same thing though.  Its missing words and has some lower case stuff that should be upper case.  I'm wondering if the list of replacements just needs to be reworked.  Something like (replace prefix, replace suffix, remove underscores, remove extension).  Here's what it prints out:

    Files:
    Business Management -financial Management Context
    Business Management -Management Context
    Business Management -service Level Management Context
    Business Management -service Portfolio Context
    Business Management -workforce Management Context
    Demand Management - Business Management -it Requests Context
    Demand Management - Management Context
    Demand Management - Management Change Management Context
    Demand Management - Project Management Context
    Demand Management - Release Management Context
    Engineering - Availability Management Context
    Engineering - Capacity Management Context
    Engineering - Configuration Management Context
    Engineering - Planning Context
    Engineering - Planning SOP
    Engineering - Problem Management Context
    Risk Management - Compliance Context
    Risk Management - Context
    Risk Management - Info Security Context
    Risk Management - Service Continuity Context
    Risk Management - Threat Management Context
    Steady State - Incident Management Context
    Steady State - Service Desk Context
    Steady State - Service Requests Context
    Steady State - Supplier Management Context
    Strategy Context

     

  9. Is there something around the keywords you're replacing that could be used? For example, in the original string is the word "bus" followed by a space? If so, you could modify the pattern to "/bus /".

     

    This got me a bit closer to a solution.  Now it prints "Bus It Requests" but I think its because its replacing a match twice.

     

    Updated function:

                    while (false !== ($file = readdir($handle))) {
                         if($file=="." or $file==".."){
                            echo "";
                         }else{
                            $pattern=array("/.pdf/","/_/","/sop/","/mgmt/","/ste/","/risk/","/eng/","/dem/","/bus_/","/_bus_it/");
                            $replace=array(""," ","SOP","Management","Steady State -","Risk Management -","Engineering -","Demand Management -","Business Management -","Business/IT Requests");
                           echo "<a href=\"$file\">" . ucwords(preg_replace($pattern,$replace,$file)) . "</a></br>";
                         }
                    }
                    closedir($handle);
                }
    
    

  10. No such luck.  Here's the bit of code I have doing it...maybe I missed something.

     

                if ($handle = opendir($_SERVER['DOCUMENT_ROOT'] . '/documents/context/')) {
                    echo "Files:</br>";
                    while (false !== ($file = readdir($handle))) {
                         if($file=="." or $file==".."){
                            echo "";
                         }else{
                            $pattern=array("/.pdf/","/_/","/sop/i","/mgmt/i","/ste/i","/risk/i","/eng/i","/dem/i","/bus_it_requests/i","/bus/");
                            $replace=array(""," ","SOP","Management","Steady State -","Risk Management -","Engineering -","Demand Management -","Business/IT Requests","Business Management -");
                           echo "<a href=\"$file\">" . ucwords(preg_replace($pattern,$replace,$file)) . "</a></br>";
                         }
                    }
                    closedir($handle);
                }
    

  11. I have a function that I use to auto-build input forms.  How would I apply the $__TEXT__ array to this?

     

    Instead of

    ucwords(preg_replace("/_/"," ",$fields->name))
    

    Could I do

    $__TEXT__[$fields->name]
    

    ?

     

    The function:

    function build_form($table_name){
       //The MySQL statement
    $sql="SELECT * FROM $table_name";
    //Result variable
    $result=mysql_query($sql);
    //If the result is empty, return.
    if($result=="") return;
    $i=0;
    //Echo some HTML for the form
    echo "<form method=\"post\" action=\"/php/process_data.php\">";
    echo "<input type=\"hidden\" name=\"selected_table\" value=\"" . $table_name . "\"/>";
    echo "<table>";
    //Echo the table name
    echo "<tr><td colspan=\"2\" style=\"font:1em arial;font-weight:bold;text-align:center;\">Input Form: " . $table_name ."</td></tr>";
    //While $i is less than the number of returned fields, complete this loop
    while ($i < mysql_num_fields($result)){
    	$fields=mysql_fetch_field($result,$i);
    	if(preg_match("/ID/",$fields->name) or preg_match("/_id/",$fields->name)){
       		   echo "<tr><td>" . ucwords(preg_replace("/_/"," ",$fields->name)) . "</td><td><input type=\"text\" size=\"30\" disabled=\"disabled\" name=\"" . $fields->name . "\" /></td></tr>";
    	   }elseif(preg_match("/comment/i",$fields->name)){
    	      echo "<tr><td>" . ucwords(preg_replace("/_/"," ",$fields->name)) . "</td><td style=\"padding:3px;\"><textarea style=\"width:98%;height:50px;resize:none;\" name=\"" . $fields->name . "\" /></textarea></td></tr>";
    	   }elseif(preg_match("/owner/i",$fields->name)){
    	      echo "<tr><td>" . ucwords(preg_replace("/_/"," ",$fields->name)) . "</td><td style=\"padding:3px;\"><select style=\"width:100%;height:24px;\" name=\"" . $fields->name . "\" /><option value=\"\"> </option>";
                   $owner_sql="SELECT employee_id,last_name,first_name FROM employees";
                   	$owner_result=mysql_query($owner_sql);
                   	$y=0;
                   	while($y < mysql_num_rows($owner_result)){
                   	   $id=mysql_result($owner_result,$y,"employee_id");
                   	   $last=mysql_result($owner_result,$y,"last_name");
                  	   $first=mysql_result($owner_result,$y,"first_name");
                  	   echo "<option value=\"$id\">$first $last</option>";
                  	   $y++;
                  	   };
               echo "</select></td></tr>";
       }else{
          echo "<tr><td>" . ucwords(preg_replace("/_/"," ",$fields->name)) . "</td><td><input type=\"text\" size=\"30\" name=\"" . $fields->name . "\" /></td></tr>";
    	   };
    	$i++;
    	};
    echo "<tr><td colspan=\"2\" style=\"text-align:center;\"><input type=\"submit\" value=\"Submit Data\" style=\"width:75%\" /></td></tr>";
    echo "</table>";
    echo "</form>"; 
    };

  12. Hi all.

     

    I'm having a bit of an issue with preg_replace and I'm not sure how to solve it.  I'm having preg_replace find a "bus" (short for business) prefix in a file name and then print "Business Management" instead of "bus".  I also have another prefix of "bus_it_requests".  When preg_replace finds that prefix, it prints "Business Management It Requests" but I need it to print "Business It Requests".  How do I have preg_replace make the distinction in the prefix matches?

  13. Thanks for the prompt reply!  Can you direct me to any resources (or give advice) on the resource file you mentioned?  I think that's probably what I want to do because there are several database fields displayed in the application currently.  It'd be nice to change them globally with ease.

  14. Hi all.

     

    I was wondering if there was a way (other than retrieving db fields with a query) to show something like "customer_id" as "Customer ID".  Is there a functionality of this nature in either MySQL or PHP?  I'm aware of preg_replace and such but that would still require two queries; one for the field names and one for the data (right?)

  15. Ah, okay.  Thank you both very much.  I have a much better understanding now.  I think the route I'll need to take is the table prefix method.  Eventually, there will be some cross-client data mining for internal purposes so I'd like to be prepared for that.  Thanks again!

  16. 1) Cross clients?

    2) So I guess I'm still kind of unsure as to what route I should take... It seems like I have three options: different databases, prefixed tables, or same tables with record identifiers(if that's even feasible).

     

    Thoughts?

  17. If I prefixed the tables, I'd still have 5500 tables (assuming 100 clients).  I guess that's why it seems like separate databases would make more sense because then they could authenticate to the database and I could reuse the same code for every client.  If I prefixed tables, wouldn't I have to adjust queries to use the proper prefix?

  18. The application database is ~55 tables so if I did separate databases for each client, that's what would be created every time.  In my head, it seems like a lot to be remaking for every client but my assumption is that security would be tremendously easier because I could set user permissions per database, correct?

  19. Hi all.

     

    I'm working on a business application that stores data for several clients.  I'm trying to figure out what the best practice is for this sort of application.  Should each client have their own database or is it safe to store all the clients data in one database?

  20. Hi all.

     

    I have a navigation menu on my homepage and everything looks and works as it should.  But when on a page other than the homepage, the nav just displays as an unordered list.  I can post pertinent code as needed but right now I don't know where the problem is.  I've compared the code for the homepage and a secondary page and they're exactly the same.

×
×
  • 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.