Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


another_noob last won the day on December 7 2014

another_noob had the most liked content!

Community Reputation

7 Neutral

About another_noob

  • Rank
    Advanced Member
  1. You still with us? I haven't seen a post in awhile which is unusual. I miss your input. I learned a lot of cool "tricks of the trade" from your posts. I hope all is well and you are busy making $$.
  2. I decided to install Yii2 on my Ubuntu server I use for live demo's for clients. While trying to install Composer I ran into permissions problems with this line of code: curl -sS https://getcomposer.org/installer | php I would get these errors: Downloading... Could not create file //composer.phar: fopen(//composer.phar): failed to open stream: Permission denied Download failed: fopen(//composer.phar): failed to open stream: Permission denied fwrite() expects parameter 1 to be resource, boolean given I prefaced the command with "sudo" and received the same permissions output. After some
  3. Good eye Larry! I am impressed that you spotted that. No one can ever say you aren't paying attention. I made the change and it works as expected. I over thought (and over looked) that detail. Thanks.
  4. I have refactored this jQuery click handler several times over. It has became the basis, and heart & soul, of several practice "single page applications". Now it looks like this: $(document).ready(function () { //Flag variable to track state of clicked element var btnProcessing; //Event attached to the document object $(document).click(function(e){ //target is the element clicked. e is the event if ($(e.target).is('.js_button') || $(e.target).is('.js_list_item')){ //Get the id of clicked element to use for the switch cases var element_id
  5. Okay, so I got this working. Here is how I did it, probably is an easier way, but I don't know one. To get the PK of the client, I send it from the clientController's actionView function when a user clicks the view icon on the index page: public function actionView($id) { return $this->render('view', [ 'model' => $this->findModel($id), 'client_id' => $id, ]); } In My client/view script that renders the list of projects belonging to the client, I now have the $client_id variable available to send as an argument to the projectController's actionCreate functio
  6. Thank you for your time Jonathon. I see what you are getting at. I don't think I was very clear in what my confusion is. I will explain this further. Same scenario, client->one-to-many->project. My client/index route renders a gridview of client names. I can click on the view icon to open a client/view&id=3 (for example). This will render my view that codes like this: <?php use yii\helpers\Html; use yii\widgets\DetailView; /* @var $this yii\web\View */ /* @var $model app\models\Client */ $this->title = $model->client; $this->params['breadcrumbs'][] = ['label' =>
  7. I hunkered down this winter to get a better grasp on OOP, MVC, frameworks, and then Yii. Now I am trying to apply all this new knowledge, or my lack of... which is about to become very obvious. I have a very simple application design concept that works flawlessly in procedural PHP. A simplified version looks like this: A database table of "client" and a table of "project". A one (client) to many (project) relationship with a "client_id" foreign key relating to "id" in client table. Couldn't be simpler. I use composer to spin up a Yii 2 skeleton, change the config/db file to my data
  8. Thanks HartleySan for the reply. I got it to work with a variation of your suggestion. Before I posted for help, I did try exactly what you suggested, I got a newline, but I would get a "undefined variable $dbc" notice and $dbc would be blank in the generated string. I had to initialize $dbc to a string literal '$dbc' for it to show up as a variable in the generated string. Like this: function make_mysqli_connection_file($db_host,$db_user,$db_pass,$db_name){ $dbc='$dbc'; $mysqli_connect_file = fopen("includes/mysqli_connect.inc.php", "w") or die("Unable to open file!");
  9. Perhaps this thread started by chop may be of some help: http://www.larryullman.com/forums/index.php?/topic/3568-e-mail-issues-related-to-php-mail-form/
  10. I am creating a basic application framework just for a challenging project. Things are going good except for this silly problem: function make_mysqli_connection_file($db_host,$db_user,$db_pass,$db_name){ $mysqli_connect_file = fopen("includes/mysqli_connect.inc.php", "w") or die("Unable to open file!"); $conn_string = '<?php $dbc = mysqli_connect ("' . $db_host . '", "' . $db_user . '", "' . $db_pass . '", "' . $db_name . '") OR die("Could not connect to MySql: " . mysqli_connect_error() );'; fwrite($mysqli_connect_file, $conn_string); fclose($mysqli_connect_file); } This function wi
  11. I had a similar complaint from a client recently. He was not receiving registration confirmation emails when his students registered for training. I used my several different email addresses in place of his and all worked fine. What I found was this: he had an AOL email account, AOL blacklisted the IP address from his shared hosting account at HostGator. I found this out by digging into the log file in his HostGator CPanel. Apparently, some knucklehead was sending oodles of spam mail from his shared host server, so... AOL blacklisted the IP, which probably affected a lot of website's email
  12. I added a needed feature to the click handler. I need to select the "action" for the controller switch case, but some times I do need a database record id from the from the button click. So I came up with a generic data attribute I will call an "extra". In my HTML here is an example how I will do it: <button id="get_dmd_form" class="button" data-action="get_dmd_pdf" data-extra="'.$dmd_row['repair_id'].'">Get DMD Form</> Now if I keep this generic attitude in my handler like this: if(extra != null){ var data = 'action=' + action + '&extra=' + extra; }else{ var
  13. I am glad I pursued this. I learned several big new things which will help me get to that ever elusive "next level", it's like a never ending ladder. Attaching the click event to the Document Object solved another issue for me. I was having trouble with dynamically created elements and attaching click events with one script. Sometimes I had to create another javascript file to attach click handlers to the dynamically created elements. I would then have to include that script in my PHP function or PHP script. It was getting confusing to keep things straight. This solved all those problems
  14. Once again HartleySan, Thank you for you time! I couldn't just leave it the way it was knowing that you suggested a better way. With some sleep, time to think, research things a little, and comparing to your javascript example, I think I have it! It works perfectly. I monitored things closely each step in firebug console and confirmed values with console.log(). I clicked away like a madman and no problems. The flag variable allowed me to eliminate the functions and function calls previously used to toggle the text values...sweet! Here is my latest code: $(document).ready(function(){ /
  15. I spent some time with your suggestions and I am half way there. Here is the HTML: <script src="js/admin_dashboard.js"></script> <?php include('includes/mysqli_connect.inc.php'); //All button ids will correspond to the associated action called in the jquery click handler echo'<div class="admin_buttons_div"> <button id="get_user_table" data-action="get_user_table" class="button">View Users</button> <button id="get_dmd_info" data-action="get_dmd_info" class="button">Get DMD Report</button> <button id="get_dmd_entry" data-action="get_d
  • Create New...