Fork me on GitHub

We're sorry. The page you requested, /index.php?module=FirstVisit, doesn't exist  Bottom

Go to page 1 - 2 [+1]:

  • Okay, so I've got firstvisit functional from a settings point of view. The Admin can choose the module, function & arguments, much like in the settings for the start page. Stored as module variables fvmod, fvfunc & fvargs.
    I can generate the proper link, but when I try to write the user function it doesn't want to work..

    Code

    function firstvisit_user_main()
        {
        $fvmod= pnModGetVar('firstvisit', 'module');
        $fvfunc= pnModGetVar('firstvisit','function');
        $fvargs= pnModGetVar('firstvisit','args');
        $link= pnModURL($fvmod,$fvfunc,$fvargs);
                   
        $pnRender = new pnRender('firstvisit');

        $pnRender->assign('fvmod', $fvmod);
        $pnRender->assign('fvfunc',$fvfunc);
        $pnRender->assign('fvargs',$fvargs);
        $pnRender->assign('fvurl',$link);
       
        return $pnRender->fetch('firstvisit_user_main.htm');
        }


    That's my function in pnuser.php

    the template is

    Code

    <!--[$link]-->


    The function is basically, identical to the admin main function, which works fine.. The template of course is only outputing what I need.. But my site tells me ..

    Quote

    We're sorry. The page you requested, /index.php?module=FirstVisit, doesn't exist

    and

    Quote

    Additional technical information

    * In FirstVisit module, main function returned.

    Once I get this done, it's just a matter of writing it as a redirect, and then figuring out how to do the hook...

    --
    Home Page | Find on Facebook | Follow on Twitter
  • That happens when the function returns an empty value.
    pnModURL is returning false because it requires:
    pnModURL(string modname, string type, string func, array args)
    so, seems that you need to parse the $args string to convert it to an array.

    A code like this might work:

    Code

    function firstvisit_user_main()
    {
        $fvmod = pnModGetVar('firstvisit', 'module');
        $fvfunc = pnModGetVar('firstvisit','function');
        $fvargs = pnModGetVar('firstvisit','args');

        $args = array();
        $fvargs = explode('&', $fvargs);
        foreach ($fvargs as $fvarg) {
            $args[] = explode('=', $fvarg);
        }

        $link= pnModURL($fvmod, 'user',$fvfunc,$args);
        ...


    Good luck icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Getting ther at least. I don't have time to troubleshoot it at the moment, gotta pick up the kiddo from school, but now I'm at least getting a $link value of..

    index.php?module=Groups&func=view&0[0]=1 Gotta figure out what's going wrong with the $args creation.

    --
    Home Page | Find on Facebook | Follow on Twitter
  • Well
    args should be formatted as usually:
    param1=value1&param2=value2&param3=value3 ...

    BTW, why new pnRender? you should use:
    $rendered = pnRender::getInstance('firstvisit') icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • So, I'm guessing the solution is to do a check to see if there are any before exploding them, and if there aren't as would be the case in the Groups module usually, ignore that part and build the URL with out the args.

    As to why new pnRender, 1, I didn't get to that part of working with pnRender about the getinstance, and second, even if I had, shouldn't there be one in admin and one in user at the very least? I probably need to study Render more, this is actually the first time I've developed using it. pnFirstVisit was the last module I developed, and let's just say the version I had on disk has modifications NS-User :)

    --
    Home Page | Find on Facebook | Follow on Twitter
  • argh I always hated dealing with arrays & explodes clearly the problem is getting the array set up right from what's stored. I guess I could create $link with out using pnModURL

    --
    Home Page | Find on Facebook | Follow on Twitter
  • Hehehehe, NS-User icon_razz
    mark implemented the singleton pattern with pnRender to avoid the creation of an instance per module/method.

    Even if $fvargs is empty, the $args will be an empty array too.
    but now i guess i get the bug in my previous code icon_razz :

    Code

    $args = array();
    $fvargs = explode('&', $fvargs);
    foreach ($fvargs as $fvarg) {
        $fvarg = explode('=', $fvarg);
        $args[$fvarg[0]] = $fvarg[1];
    }


    Sorry

    --
    - Mateo T. -
    Mis principios... son mis fines
  • That did the job, thanks I knew I was missing something, I just hadn't had a chance to check out practical use of the process yet. It's been awhile :)

    One more bit of stuff to figure out and then I can test it and release it I hope :)



    edited by: HalbrookTech, Jan 15, 2009 - 12:41 PM

    --
    Home Page | Find on Facebook | Follow on Twitter
  • icon_wink Looking forward to it
    anyways, you're just printing a link?
    you can call pnModFunc or pnRedirect for FirstVisit

    what's the idea?

    --
    - Mateo T. -
    Mis principios... son mis fines
  • I'm using pnRedirect :) I was just printing the link during testing, rather than having the module redirectme wrong :)

    Now I just gotta figure out if I'm barking up the wrong tree on the rest of the functionality. I know the new user process is hooks aware, so I'm HOPING that means I can hook FirstVisit to it, and have it send new users to the defined location. I've not worked with hooks, so I'm not 100% sure how to do it, but that's the last thing I've got to do, if it can be done that way.

    --
    Home Page | Find on Facebook | Follow on Twitter
  • Mmmmmm
    Hooks just listen right now, and to redirect to an specific location, well, i don't know how it "hurts" the registration process... mmmm, taking a look, it seems that if you listen the Users 'create' process and use a pnRedirect there, it doesn't do the job because the user is not logged after the registration, and conflicts if the user registration is moderated or if the registration is verified through email (no status message saying: check your inbox!)

    So, you definitely need the login-hook and a DB table with the already redirected Users to discard them...

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Yeah, that's how it used to work, other than the fact that there was no login hook, so the original version required a modification to the user module to work. We get the login hook at 1.2 right?

    --
    Home Page | Find on Facebook | Follow on Twitter
  • I don't know, hope to, but i'm not in charge of that part, push to the one in charge icon_razz icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Actually looks like the login hooks are there in the SVN now, I just did an SVN Export, and installed it on a test site, and the Admin says it 1.2-dev. Now i just gotta understand how to register a hook for it :)

    --
    Home Page | Find on Facebook | Follow on Twitter
  • Cool!
    Good luck with that icon_wink
    after that, tell us how you did to register that Hook

    --
    - Mateo T. -
    Mis principios... son mis fines

Go to page 1 - 2 [+1]:

This list is based on users active over the last 60 minutes.