Jump to content

falkencreative

Advanced Member
  • Posts

    4,419
  • Joined

  • Last visited

  • Days Won

    27

Posts posted by falkencreative

  1. @grabenair:

    You NEED to put a break in the code to stop or will keep going for ever and can cause problems.

    Not quite true -- a for loop has an automatic break built in. In the code above, it should break after i is no longer less than products.length. (We're also dealing with Javascript here, not PHP.)

     

    @Ed4Words:

    When I run that code (and assuming I click on the header, obviously), the system prints out the four array items, then stops. As far as I can tell, it's working correctly. What is happening that makes you think the code is still running?

  2. I get the same issue. I don't think this is necessarily PHP related though -- I think it's a Javascript/AJAX issue. I'd probably suggest contacting the makers of the ecommerce plugin -- I can't imagine that you are the only person with this issue.

  3. Sorry, it doesn't work that way. A PSD is a Photoshop file -- a design that is usually sliced into multiple separate image files and used in the website's HTML code. You really can't go backward without recreating the PSD from scratch.

  4. Yes, it's OK to use multiple stylesheets.

     

    However, I don't really see any problem with using a single stylesheet that controls multiple page layouts. For example, you could add a class to the body tag on the page that would indicate the layout you are using on that page, then use that class when adding styling. For example:

     

    .layout1 #header { ...one set of styles for the header in layout #1... }

     

    .layout2 #header { ...another set of styles for the header in layout #2... }

  5. I think the key issue is where you are defining the variables -- as properties within a class. From the documentation (http://php.net/manual/en/language.oop5.properties.php):

     

    "This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated."

     

    In short, you can assign a class property a specific value, but it can't be based on another variable -- at least, not where you are currently defining that property within the class.

     

    An alternate way around this would be to the setting of values within the __construct() method:

     

    class pagination 
    {
    private $limit = 30;
    private $start = 0;
    private $eu;
    private $space;
    private $this1;
    private $back;
    private $next;
    private $k;
    
    public $beg;
    public $end;
    
    function __construct($persons_name) {           
         $this->eu = $this->start - 0;
         $this->this1 = $this->eu - $this->limit;
         ...etc...
    }
    
    

  6. In and of itself, that doesn't do anything. However, if you were to create an object:

     

    $person = new person();

    $person->set_name('Bob');

    echo $person->get_name();

     

    you can use that method to set the name. $new_name has a value of whatever is passed into the set_name method when it is called (for example, "Bob").

  7. Those are two separate things. The "class person" is an example of object oriented programming (OOP) -- it's a design pattern, and can be used as an organizational structure to create an object that retrieves information from a form and processes it... but in and of itself, OOP can't do what you are after.

     

    To retrieve data from a form, you'd need to use $_POST[] and to send it to the database, you'd need to use a connection to a database (MySQL, MySQLi or PDO) and an SQL "insert" command. I wrote an example application that adds/deletes and edits data from a database. Might be worth checking out to help you get started? http://www.killersites.com/community/index.php?/topic/3064-basic-php-system-view-edit-add-delete-records-with-mysqli/

  8. I've tested your code on my own machine, and I'm not having any problems. After running that code I get "stefan". What sort of server setup are you using? WAMP? MAMP? Something else? As far as I know, this code should work the same and you shouldn't need to modify any settings for this to work.

  9. The main thing that appears not to be working is your jQuery on() function.

     

    $('#fp_cancel').on('click', function(e){
    		e.preventDefault();
    		$.colorbox.close();
    	});

    Note this section in the documentation (especially the first sentence):

     

    Event handlers are bound only to the currently selected elements; they must exist on the page at the time your code makes the call to .on(). To ensure the elements are present and can be selected, perform event binding inside a document ready handler for elements that are in the HTML markup on the page. If new HTML is being injected into the page, select the elements and attach event handlers after the new HTML is placed into the page. Or, use delegated events to attach an event handler, as described next.

     

    Delegated events have the advantage that they can process events from descendant elements that are added to the document at a later time. By picking an element that is guaranteed to be present at the time the delegated event handler is attached, you can use delegated events to avoid the need to frequently attach and remove event handlers. This element could be the container element of a view in a Model-View-Controller design, for example, or document if the event handler wants to monitor all bubbling events in the document. The document element is available in the head of the document before loading any other HTML, so it is safe to attach events there without waiting for the document to be ready.

    #fp_cancel elements are added to the page after the page is loaded, so you need to change your on() call to use a delegated events to attach an event handler (it's inserted at the end of the document, so you'd likely need to use "body". The documentation provides this example -- you'd need to follow this as an example:

     

    $("#dataTable tbody").on("click", "tr", function(event){

    alert($(this).text());

    });

     

    http://api.jquery.com/on/

     

    Hope that helps?

  10. No one has responded to this yet, so thought I'd leave a quick comment...

     

    In regards to "$stefan = new person();" that's just what he happened to name the variable. There's no exact reason for using a person's name, and yes, using a more general name like $name or something similar would make more sense. The exact variable name doesn't change the value that it holds.

  11. That shouldn't be happening... the add to cart functionality is done using PHP -- not something that should be effected by the choice of browser. Do you have the site online anywhere? You can also zip up the code/dump of the database, and I can look at it for you (email to ben [at] killersites.com) but I'm super busy right now and probably won't have the chance to look at it until the end of the week/the weekend.

  12. The browser can't find these files:

     

    http://localhost/frontcms/app/resources/css/fp_style.css

    Failed to load resource http://localhost/frontcms/app/resources/javascript/colorbox/colorbox.js

    Failed to load resource http://localhost/frontcms/app/resources/javascript/colorbox/colorbox.css

     

    Looks like they are all pointing to a localhost location rather than your live site.

     

    also wondering if theres a way with php to add a user to mysql, add database etc.

    For example, to help with the install process on a CMS? I don't think so, though I haven't really done any research on the subject. Wordpress might be a good example to follow: they have an installer where the user enters the database details, and then the system automatically sets up the required database tables and an admin user.

  13. What browser are you viewing the site in? Using Chrome (Chrome 24, Mac) I've logged into your CMS and tested your site, and everything seems to be working correctly for me -- the popups are opening and closing correctly.

     

    In regards to using Mercury, yes, you could switch out TinyMCE for something else. I can't really provide support for that process though -- I've never used Mercury and I'm not familiar with Rails.

×
×
  • Create New...