Jump to content

hansford

Members
  • Posts

    562
  • Joined

  • Last visited

  • Days Won

    4

hansford last won the day on November 29 2016

hansford had the most liked content!

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

hansford's Achievements

Member

Member (2/5)

16

Reputation

3

Community Answers

  1. hansford

    MVC

    For one thing...modern frameworks are constantly being updated and improved. Another thing is that is what companies want when looking to hire a developer. You should understand the MVC design pattern and how each part works, but then go learn a modern framework.
  2. This question is rather specific pertaining to a Wordpress plugin of which there are numerous. You might be better off trying to post your question to the plugin QA site. https://wordpress.org/support/plugin/advanced-custom-fields
  3. hansford

    MVC

    I wrote a custom one when I was trying to wrap my head around it. This is what my index.php page looks like. <?php require($_SERVER['DOCUMENT_ROOT'] . '/config.php'); require_once(ROOT . '/common.php'); // set the path separator define('PS','/'); require_once(APP . '/common.php'); // load system files require_once(SYS . 'Model.php'); require_once(SYS . 'Load.php'); require_once(SYS . 'View.php'); require_once(SYS . 'Controller.php'); require_once(SYS . 'Router.php'); // load the database require(DB); // load routes configuration require(APP . '/config' . PS . 'routes.php'); // launch application $router = new Router($routes); $router->init();
  4. Hi guys and girls, A recruiter asked me to do this coding challenge and was wondering if you had a more elegant solution or your thoughts on it. EXERCISE FOR DEVELOPER CANDIDATES: Unit Number Sorting Exercise We often deal with unit number / resident name data. These two pieces of information are used by our users to identify a lease. Many of our screens and reports show a list of leases. The task is to sort lease data read from a file and to print the sorted data to STDOUT. The data looks as follows (sample also attached): #50 - Smith #8 - Johnson #100 - Sanders #1B - Adams #1A - Kessenich Each line contains a unit number and a resident name. The data should be sorted by unit number. Develop a solution in PHP and one other language of your choice that reads the data from a file and prints the data (sorted by unit number) to STDOUT. The printed strings should not be modified from how they appear in the input file. Here is my solution: <?php define('br','<br />'); // open the file $fp = fopen('input.txt','rb+'); if (false === $fp) { die ('failed to open file'); } $numbers = array(); $letters = array(); // read the file line by line while (($line = fgets($fp, 1024)) !== false) { // split the string by unit number and name $str = explode(' - ',$line); // separate unit numbers from units with letters if (preg_match('/[a-zA-Z]/', $str[0])) { $letters[$str[0]] = $str[1]; } else { $numbers[$str[0]] = $str[1]; } } if ( ! feof($fp)) { die ('error reading file'); } fclose($fp); // sort each array ksort($numbers,SORT_STRING); ksort($letters,SORT_STRING); // merge arrays with unit letters appearing first $output = array_merge($letters, $numbers); // output data foreach ($output as $key => $value) { echo $key . ' - ' . $value . br; }
  5. Sure. Put the script which dynamically generates the banner in a div and just hide the div after it's clicked.
  6. You have 2 options to accomplish this. Using plain JavaScript or with jQuery (or other library). I'll post the JavaScript way. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Insert title here</title> </head> <body> <a id="banner" href="http://www.purple.com" target="_blank"><img src="banner.jpg" width="400" height="150"></a> <script type="text/javascript"> window.onload = function() { var el = document.getElementById('banner'); el.addEventListener("click",function() { this.style.display = "none"; }); }; </script> </body> </html>
×
×
  • 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.