Menu

Using subdirs

php.MVC
Ikaruz
2006-09-26
2013-04-11
  • Ikaruz

    Ikaruz - 2006-09-26

    Hi

    We are using phpmvc for a while and needed at this time some installations in subdirectorios but without changing phpmvc-config.xml. We had the rpblema that every time the path was relative we were moved to root dir.

    The only way we found was includding a variable in Main.php ($appSubDir = "mysubdir") where we set up a subdir and then modified RequestProcessor.php line 481 as follows:
    global $appSubDir;
    if (!empty($appSubDir))
    $redirPath = $pathScheme.$host."/".$appSubDir.$path; // $path starts with "/"
    else
    $redirPath = $pathScheme.$host.$path; // $path starts with "/"

    Are we missing something? can be this included as a standart feature for future releases? we ahve being looking but didn't find a solutions for running on different subdirectiries without changing the phpmvc-config.xml

    Thank in advance for any advice
    Gustavo

     
    • John Wildenauer

      John Wildenauer - 2006-09-26

      G'day Gustavo,

      Does this help ?

      Latest php.MVC library releases are here:
      http://phpmvc.net/download/cvsIdx.php?doc=cvs-snaps

      CYL
      John

      HowTo - ContextPath/Redirect

      ContextPath/Redirect (client-side)
      Absolute/Relative Paths:

      If a path starts with a slash it is a /relative/ path to the application,
          so the context-path ("MyShopA) is automatically prepended to the path.
          Home   : http://MyHost/MyShopA/
          Path   : "/Main.php?do=redirectAction"
          Becomes: "MyShopA/Main.php?do=redirectAction"
          Becomes: "http://MyHost/MyShopA/Main.php?do=redirectAction"

      If a path does /not/ starts with a slash it is absolute. So we assume the
          path already contains a valid context-path.
          Home   : http://MyHost/MyShopB/
          Path   : "MyShopB/Main.php?do=redirectAction"
          Becomes: "MyShopB/Main.php?do=redirectAction"
          Becomes: "http://MyHost/MyShopB/Main.php?do=redirectAction"

      The Forward mapping would look something like:

      phpmvc-config.xml

       <\!-- Redirect : A \*\*\*new\*\*\* client \(browser\) request                         -->
       <action    path = "redirectAction"
                      type = "RedirectAction"
                    scope = "request">
      
           <\!-- The forward path is now a URL - redirect="true"                      -->
      
          <\!-- Relative path \(leading slash\). The context-path is automatically       -->
          <\!-- prepended to the path.                                                                -->
           <forward 
                name     = "redirect\_path" 
                path     = "/Main.php?do=newRequest"
                redirect = "true"/>
          
      <\!-- OR -->
      
           <\!-- Absolute path \(no leading slash\). Assume a correct context path. -->
           <\!-- to our application.                                                                -->
           <forward 
                name     = "redirect\_path" 
                path     = "Test/ContextPath/Main.php?do=newRequest"
                redirect = "true"/>
       </action> 
      
      Quick Start Guide
      =================================================
      
      Tools for non English speakers:
      

      Babel Fish Translation
      http://babelfish.altavista.com/

      Google Translation page
      http://www.google.com.au/language_tools?hl=en

      Freelang - Free Translation Dictionaries
      http://www.freelang.net/

      Latest php.MVC library release:

       http://phpmvc.net/download/cvs/phpmvc-base-dev-1.0.0-release\_2006\_02\_24\_1730.tgz
       or
       http://phpmvc.net/download/cvs/phpmvc-base-dev-1.0.0-release\_2006\_02\_24\_1730.zip
      
      A test application is available here: 
      

      http://phpmvc.net/download/rel/phpmvc-latest-release-test-app.tgz
      http://phpmvc.net/download/rel/phpmvc-latest-release-test-app.zip

      Documentation

      Index of php.MVC documentation
      http://phpmvc.net/docs/docsIdx.php
      
      User Guides
      

      Index of php.MVC User Guides
      http://phpmvc.net/docs/guides/guidesIdx.php

      Introductory Guide 101 to php.MVC
      http://phpmvc.net/docs/guides/guidesIdx.php?doc=phpmvc-101

      Downloads

      Index of php.MVC downloads
      http://phpmvc.net/download/downloadIdx.php
      
      Small examples using php.MVC
      http://phpmvc.net/download/downloadIdx.php?doc=other-releases
      
      Latest php.MVC library release: 
      http://phpmvc.net/download/cvsIdx.php?doc=cvs-snaps
      
      SleeK Action Wizard
      

      The Wizard will build a sample php.MVC application to help new users to get
      started with php.MVC.

      SleeK Action Builder: A Program for Building php.MVC Web Applications
      http://www.phpmvc.net/builder/builderIdx.php?doc=wiz-intro

      SleeK Action Wizard for php.MVC Users Guide (176Kb):
      http://www.phpmvc.net/docs/guides/guidesIdx.php?doc=action-wiz
      http://www.phpmvc.net/download/builder/ProjectWizardGuide_1.0.zip

      Download SleeK Action Wizard ( 52Kb):
      http://www.phpmvc.net/download/builder/ProjectWizard_1.1-20060224.zip

      The only items you should need to change in the Wizard are:

      Page1: The Application name

      Page3:
      (A) The path to the new application (like: C:\Apache\htdocs\MyAppl)
      (B) The path to the php.MVC library (like: C:\WWW\phpmvc_net)

      The Wizard will build the "new" style front-end for the application

      --~~~---

       
      • Ikaruz

        Ikaruz - 2006-09-29

        John
        Thank you for your answer, but unfortunately we are trying to make it work without success.
        We downloaded the last version again, but maybe we have something from prior versions that doesn't let this to work properly. No matter if we put the / at the beginning of the path.
        We did what I posted because we have read some "old" post and was looking that in prior versions there wasn't that option available (was that way no?)
        Will be making some other test to look if we can make it work properly. Otherwise will be asking here again. :)

        On the other hand, we are using jpgrap for this application and we found an error that is being caught by jpgrap. The error is:

        General PHP error : Non-static method BootUtils::getActionPath() should not be called statically

        the line capturing the error is this:
        if( isset($GLOBALS['php_errormsg']) && CATCH_PHPERRMSG &&
            !preg_match('|Deprecated|', $GLOBALS['php_errormsg']) ) {
            JpGraphError::RaiseL(25004,$GLOBALS['php_errormsg']);
        }

        We are using php 5.1.5

        Thanks
        Gustavo

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.