SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: PHP5 GUI Reuse

  1. #1
    SitePoint Addict
    Join Date
    Oct 2005
    Posts
    288
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    PHP5 GUI Reuse

    I am so clearly off base that no-one seems to understand my question -- and I can't come up with keyword searches that come close to my issue.

    I am using PHP5 classes and what I understand as OOP methodolgy to write a simple CRUD application.

    My visitor arrives at the index.php where I want to send a screen with the message "Please enter your name and password and select a day or list". The screen contains xhtml input fields for name and password, checkboxes for each day of the week and a group of radio buttons for available lists. The form action sends the user to /menu/post.php

    /menu/post.php instantiates a new menu_postgui Class that inherits from (extends) abstract_postgui. Among its tasks is to validate the data entered.

    If the data is NOT valid, I want to send back the original screen filled in with what the visitor entered and the message(s) indicating what errors I found (without duplicating the xhtml code).

    If the user data passes the menu_postgui Class validation, I want to instantiate the proper class for the selected option (which I do through a switch-case element) which will send its own xhtml form. (which will have the similar requirements for error-reporting).

    As of yet, I have not been able to send an xhtml to the screen by imbedding <?php ?> if I try to put it in a CLASS. Nor have I found a way (except through $_SESSION) to pass msgs and such to a pure php (i.e. not a class) script.

    Does anyone have a simple example of how to logistically handle user interface with oop validations (without duplicating the XHTML code)?

    It can't be as hard as I'm making it.

    Regards.

    grNadpa

  2. #2
    SitePoint Addict
    Join Date
    Oct 2005
    Posts
    288
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    For what it's worth ...
    I've gone back to my original approach of substituting (with braces) in heredoc enclosed xhtml.
    grNadpa

  3. #3
    SitePoint Addict
    Join Date
    Oct 2005
    Posts
    288
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    One last tidbit -- might be worth a sticky --

    I could not code the '<link' address to consistently pull in the stylesheet (depending on which parent instantiated the code-generating class). Using an algorithm with $_SESSION didn't work. Neither did __DIR__.

    What did work, at least in my test, was to code the href as a literal beginning with "http://localhost/..."

    grNadpa

  4. #4
    SitePoint Addict
    Join Date
    Oct 2005
    Posts
    288
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Nope. "localhost" doesn't work when I move it over to my host site.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •