Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 30

Thread: Need a little direction with fmcompute.

  1. #11
    Join Date
    Dec 2008
    Location
    Maryland
    Posts
    82

    Default Re: Need a little direction with fmcompute.

    Quote Originally Posted by russellr View Post
    Hi,



    Yes, this all looks exactly right.

    So, the fmcomputes execute to process and create fields when the page is submitted.

    Then, the next page is loaded and processed as a template. The template uses the fields that were submitted (and created by fcompute and derive_fields) previously.
    The problem lies in advance templates. When I load an advance template with the <if "$make_is_ford"> it will not show up in the form. I do not know how to get my advance templates to show?

  2. #12
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Need a little direction with fmcompute.

    Hi,

    I have not been able to hide your first fmcompute1 in my ini file. Any pointers on getting this to work? I have tried every way I can think of.
    I don't think you should be using an INI file, but the process i straightforward.

    Remember the same INI file is loaded for each page - so, the same computations will be executed on each page. That's not going to easily work for you.

    You'd have to have a page identifier and then an IF statement with computations for each page.

    All gets very messy.

    Write down your threat model and determine exactly what needs to be hidden and why. Be minimalist.

    E.g. does knowledge of your directory structure matter? If so, why?

    E.g. does knowledge of the list of vehicles matter? If so, why?

    etc. etc.

    The easy answer is "I don't know - I just want to hide everything". In that case then you'd be better to take the road of writing everything in PHP, either using the Hook System or discard FormMail altogether.

    But, that road leads to all sorts of security issues - writing secure PHP code is hard.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #13
    Join Date
    Dec 2008
    Location
    Maryland
    Posts
    82

    Default Re: Need a little direction with fmcompute.

    Please give me one example on how to hide that fmcompute. Based on everything I have learned I will only need the one fmcompute on the front page. Your logic seems like it will do everything I need if I can get the templates working to.
    Last edited by billy; 14-Dec-2008 at 08:14 PM. Reason: lil more info

  4. #14
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Need a little direction with fmcompute.

    Hi,

    I have not been able to hide your first fmcompute1 in my ini file. Any pointers on getting this to work? I have tried every way I can think of.
    This fmcompute:
    HTML Code:
    <input type="hidden" name="fmcompute1" value="
    import function FMUserError;
    import string make;
    import string year;
    export string make_is_ford;
    export string make_is_toyota;
    export string year2009;
    export string year2008;
    export string year2007;
    
    if (make == 'ford')
    {
     make_is_ford = '1';
    }
    " />
    Goes into an INI file like this:
    Code:
    [special_fields]
    fmcompute1 = "
    import function FMUserError;
    import string make;
    import string year;
    export string make_is_ford;
    export string make_is_toyota;
    export string year2009;
    export string year2008;
    export string year2007;
    
     if (make == 'ford')
    {
     make_is_ford = '1';
    }
    "
    To work with different pages (I mentioned this could get messy above), you can do this:
    Code:
    [special_fields]
    fmcompute1 = "
    import function FMUserError;
    import int PageNumber;
    
    
    if (PageNumber == 1) 
    {
        /* logic for submission of first page */
     import string make;
     import string year;
     export string make_is_ford;
     export string make_is_toyota;
     export string year2009;
     export string year2008;
     export string year2007;
     
     if (make == 'ford')
     {
      make_is_ford = '1';
     }
     /* and so on.... */
    }
    elseif (PageNumber == 2)
    {
        /* logic for submission of second page */
     import float Price;
    
     if (Price < 1000)
     {
       FMUserError('Your car does not cost enough');
     }
     /* and so on.... */
    }
    elseif (PageNumber == 3)
    {
        /* logic for submission of third page */
    }
    "
    Get the idea?

    It's probably not as messy as I suggested.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  5. #15
    Join Date
    Dec 2008
    Location
    Maryland
    Posts
    82

    Default Re: Need a little direction with fmcompute.

    Oh you are the man! That looks like it will do it. Sweet! Russell what am I doing wrong with the advance templates. Your logic in the fmcomputes makes reference to the advance templates. Why wont they display? I have wrapped them in php tags, plain html and yet there is nothing but a blank page? Seems like something very basic is missing it's just weird.
    Last edited by billy; 14-Dec-2008 at 08:29 PM. Reason: lil more info

  6. #16
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Need a little direction with fmcompute.

    Hi,

    Quote Originally Posted by billy View Post
    Oh you are the man! That looks like it will do it. Sweet! Russell what am I doing wrong with the advance templates. Your logic in the fmcomputes makes reference to the advance templates. Why wont they display? I have wrapped them in php tags, plain html and yet there is nothing but a blank page? Seems like something very basic is missing it's just weird.
    I'll need to take a look.

    Please tell me the url for your form so I can see the failure.

    And, send me your formmail.php file, INI file and template file (email to supportstaff AT tectite DOT com).
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  7. #17
    Join Date
    Dec 2008
    Location
    Maryland
    Posts
    82

    Default Re: Need a little direction with fmcompute.

    Okay give me a few minutes to set up the demo Russell because I have hacked the heck out of it trying to get it to work.

  8. #18
    Join Date
    Dec 2008
    Location
    Maryland
    Posts
    82

    Default Re: Need a little direction with fmcompute.

    I sent the files for the one html test site. I did not include the files for the data driven site. I put that together pretty fast. The point is I had everything in there from the start. The way I thought it should be. Then I whittled it all down to the basis and still could not figure out where I went wrong. So I am sure its not perfect but yet a small sample of the code your provided. Of course it does not have any of the new stuff you have posted today! I still need to catch up with that and chew on it a little.

    I private messaged your the two urls.

    Thanks for your time!
    Last edited by billy; 14-Dec-2008 at 09:42 PM. Reason: lil more info

  9. #19
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Need a little direction with fmcompute.

    Hi,

    OK, one of them (the coloured one) seems to work fine.

    BTW, you mentioned somewhere about a CMS.

    It should all be able to work well together, but the usual problem is relative URLs.

    So, if you have things like src="a-relative-url", then you can get into problems.

    On the other hand, full URLs like "src="http://mysite.com/document.html" can often work best.

    But, it all depends on the underlying systems and your directory structure.

    There's no substitute for understanding what your systems (e.g. CMS and FormMail) require and planning your solution accordingly.

    For example, if your CMS insists on using relative URLs, then you need to structure your directories and use appropriate URLs and paths inside FormMail.

    The first step is understanding the problem(s).
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  10. #20
    Join Date
    Dec 2008
    Location
    Maryland
    Posts
    82

    Default Re: Need a little direction with fmcompute.

    OK, one of them (the coloured one) seems to work fine.
    Good evening Russell,

    Its just an iframe pulled into a custom html block. Nothing fancy at all. This is not the way I want to set up my site. You lose so much of the power and beauty of running data driven stuff.

    BTW, you mentioned somewhere about a CMS.
    It should all be able to work well together, but the usual problem is relative URLs.

    So, if you have things like src="a-relative-url", then you can get into problems.

    On the other hand, full URLs like "src="http://mysite.com/document.html" can often work best.

    For example, if your CMS insists on using relative URLs, then you need to structure your directories and use appropriate URLs and paths inside FormMail.

    But, it all depends on the underlying systems and your directory structure.
    Yep I understand and I should be able to get around some of this with mod_rewrite and a little more indepth cms that loves absolute urls. Thanks for pointing this out to me because it is a very important topic.

    There's no substitute for understanding what your systems (e.g. CMS and FormMail) require and planning your solution accordingly.
    The first step is understanding the problem(s).
    Amen

    I was sitting here thinking just that Russell. I have been digging thru all the different systems I have used over the years. I have come up with a few winners in that regard. But I also come up short on the design aspect as they all wrap their systems pretty much the same way around custom apps.

    Example:

    Code:
    <?
    include_once 'includes/bla.php';
    cms_page_header();
    include_once 'includes/bla_bla.php';
    
    // $status = menu_execute_active_handler();
    
    $status1 = do_first_stuff();
    include("myapp/index.php");
    $status2 = do_other_stuff();
    
    cms_page_footer();
    ?>
    
    Directory called myapp which has an index.php file and other app files:
    
    /myapp/index.php
    /myapp/showbasic.php
    /myapp/showdetails.php
    etc.
    btw bs code people...

    Anyway Russell one of my major questions is How can I dynamically wrap your fm?

    I have already had a run in with smarty. Seems like that is a show stopper to me!

    As I am sure you already know how to wrap your code in stuff. I am going to take all this to emails if you don't mind?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. INI FILES and fmcompute
    By stehl in forum FormMail Computation Module
    Replies: 3
    Last Post: 11-Dec-2009, 09:39 PM
  2. Cant get fmcompute to work
    By stehl in forum FormMail Computation Module
    Replies: 12
    Last Post: 24-Nov-2009, 04:00 AM
  3. help with csv and fmcompute
    By drquijote in forum HOWTO Guides and Tips
    Replies: 1
    Last Post: 09-Dec-2008, 08:21 AM
  4. Trouble loading fmcompute module
    By aaron_w in forum FormMail Computation Module
    Replies: 2
    Last Post: 09-May-2008, 01:29 AM
  5. email not sent after fmcompute
    By aussieworld in forum Features Questions
    Replies: 4
    Last Post: 12-Jun-2007, 07:55 PM

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
  •