Search Results

Search found 5 results on 1 pages for 'franko75'.

Page 1/1 | 1 

  • PHP - Concatenating objects and casting to string - bad idea?

    - by franko75
    Is it bad practice to concatenate objects when used in this context: $this->template->head .= new View('custom_javascript') This is the way i normally add extra css/js stuff to specific pages. I use an MVC structure where my basic html template has a $head variable which I set in my main Website_controller. I have used this approach for a while as it means I can just add bits and pieces of css/js stuff from whichever page/controller needs it. But having come across a problem in PHP 5.1.6 where the above code results in "Object ID #24", the result of toString() not being called i think, I am rethinking whether i should just fix this to work in PHP 5.1.6 or if i should rethink this approach in general. Any pointers appreciated!

    Read the article

  • qTip pop ups come in from top left of screen (on first load)

    - by franko75
    Hi, not sure if i'm set things up incorrectly - I don't seem to see anyone else with this problem, but my qTip popups (all ajax loaded content) are loading quite erratically, in that they are often animating in from off screen before appearing in the correct position. Is there a simple solution to this which I may have missed? Thanks again for your help. HTML markup: <span class="formInfo"> <a href="http://localhost/httpdocs/index.php/help/kc_dob" class="jTip" name="" id="dob_help">?</a> </span> qTip initialisation.. //set up for qtip function initQtip() { $('a.jTip').each(function() { $(this).qtip( { content: { // Set the text to an image HTML string with the correct src URL to the loading image you want to use text: '<img src="/media/images/wait.gif" alt="Loading..." />', url: $(this).attr('href') // Use the rel attribute of each element for the url to load }, position: { adjust: { screen: true // Keep the tooltip on-screen at all times } }, show: { when: 'click', solo: true // Only show one tooltip at a time }, hide: 'unfocus', style: { tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner border: { width: 10, radius: 10 }, width: { min: 200, max: 500 }, name: 'light' // Use the default light style } }); //prevent default event on click }).bind('click', function(event){ event.preventDefault(); return false; }); }

    Read the article

  • OOP/MVC advice on where to place a global helper function

    - by franko75
    Hi, I have a couple of controllers on my site which are handling form data. The forms use AJAX and I have quite a few methods across different controllers which are having to do some specific processing to return errors in a JSON encoded format - see code below. Obviously this isn't DRY and I need to move this code into a single helper function which I can use globally, but I'm wondering where this should actually go! Should I create a static helper class which contains this function (e.g Validation::build_ajax_errors()), or as this code is producing a format which is application specific and tied into the jQuery validation plugin I'm using, should it be a static method stored in, for example, my main Website controller which the form handling controllers extend from? //if ajax request, output errors if (request::is_ajax()) { //need to build errors into array form for javascript validation - move this into a helper method accessible globally $errors = $post->errors('form_data/form_error_messages'); $i = 0; $new_errors = array(); foreach ($errors as $key => $value) { $new_errors[$i][0] = '#' . $key; $new_errors[$i][1] = $value; $new_errors[$i][2] = "error"; $i++; } echo '{"jsonValidateReturn":' . json_encode($new_errors) . '}'; return; }

    Read the article

  • Help dealing with data dependency between two registration forms

    - by franko75
    I have a tricky issue here with a registration of both a user and his/her pet. Both the user and the pet are treated as separate entities and both require separate registration forms. However, the user's pet has to be linked to the user via a foreign key in the database. The process is basically that when a new user joins the site, firstly they register their pet, then they register themselves. The reason for this order is to check their pet's eligibility for the site (there are some criteria to be met) first, instead of getting the user to sign up only to then find out their pet is ineligible. It is this ordering of the form submissions which is causing me a bit of a headache, as follows... The site is being developed with an MVC framework, and the User registration process is managed via a method in a User_form controller, while the pet registration process is managed via a method in the Pet_form controller. The pet registration form happens first, and the pet data can be saved without the owner_id at this stage, with the user id possibly being added (e.g by retrieving pet's id from session) following user registration. However, doing it this way could potentially result in redundant data, where pet records would be created in the database, but if the user doesn't actually register themselves too, then the pets will be ownerless records in the DB. Other option is to serialize the new pet's data at the pet registration stage, don't save it to the DB until the user fills out their registration form. Once the user is created, i can pass serialised data AND the owner_id to a method in the Pet Model which can update the DB. However, I also need to set the newly created $pet to $this-pet which I then access for a sequence of other related forms. Should I just set the session variable in the model method? Then in the Pet controller constructor, do a check for pet stored in session, if yes, assign to $this-pet... If this makes any sense to anybody and you have some advice, i'd be grateful to hear it!

    Read the article

  • Slick PHP based image manager for managing user profile images

    - by franko75
    Hi, I'm just throwing this out there as I'm plodding my way through creating a Member Photo album on a site i'm working on, where they can login and upload their photos to a personal gallery. I want this to be nice and lightweight, but still slick and "modern" with a modal based interface for the user. I'm surprised though that there is seemingly nothing open source out there which fits the bill - I've done a few searches on Google to no avail and can't seem to find anything. Lots of bloated photo galleries out there but nothing looks like it has been developed using more recent technologies. Is anyone aware of anything which might suit what I'm looking for? I'm fully prepared to try and code it myself but I'd be delighted if I didn't have to! Pure laziness you might say, but there's no point reinventing the wheel.

    Read the article

1