Codeigniter how to access views/web pages from third party folders - php

I am in the process of installing SimpleSAML and in the php library, there is a folder called www that has index.php. According to the docs, there is an admin console within it. However, at the moment I am unable to access it via the url www.website.com/third_party/simplesaml/www/index.php.
I am supposed to use the admin console to generate some metadata so I'm just wondering if it is possible to route to a view from there?
I'm thinking that I create a controller and just hard link $this->load->view('url to www') but I'm not sure if that works.

In controller’s constructor add
include APPPATH . 'third_party/simplesaml/www/index.php';
to include the file in your project.

you can set base path in route file and instead of $this->load->view() you can use renderView() function to access view in codeigniter.

Related

How to get session variable/data outside of laravel project?

Is there any way to get session variable/data outside of the laravel application?
I have a project in core php (e.g: myproject) directory and now I want to signup/signin from laravel which will be placed in internal directory (e.g: myproject/laravel). I want to get signed-in user's details through session in myproject directory.
Is there any way/alternate for that?
You will have to add session_start(); in public/index.php on the top.
After that still need to set your external sessions in the classic way $_['mysession'] = 'something';. Remember that this will not work if you want to access auth() methods outside Laravel.

How to get Parameter names in ZF2 site's Index Controller?

Hi currently i am doing project in ZF2. In my project there are lot of folders in public directory. when any of visitor enter www.domain.com/folder-name it should redirect to that folder in public directory. in scenario how can i get that name of the folder name into one variable in site IndexController
Your question is not very clear to me. When you call a sub-folder within /public, then depending on your ReWrite-Rules, you'll either get 403 Forbidden or you'll get the DirectoryIndex. If you call a file, you'll see the file.
Either way, ZF2 isn't even running at that time.
What kind of variable do you want to have in your Controllers and for what purpose? Do you want to create something like a DirectoryListing?

Symfony2 and Marketplace Web Services

I created script which uses Amazon Marketplace Web Services and I want to put it inside a controller indexAction() function. However when I do this it says that
Class 'MarketplaceWebServiceOrders_Client' not found in path_to_my_bundle
How can I load this class in correct way? Should I place
amazon-mws-v20090101-php-2012-09-28.V386158529
amazon-mws-v20110101-php-2012-09-28.V386158559
folders under vendor folder and register it somehow?
You have problem with your include path, Set include_path in php.ini. or If you show your code then we can help you to find out the problem.

HMVC and Views in folders (Codeigniter)

I am using Tank Auth library in Codeigniter with HMVC and the entire tank auth mvc files are in its own module called 'auth'. tank auth loads a view (domain.com/application/modules/auth/views/auth/login_form.php) found inside a folder (auth) using:
$this->load->view('auth/login_form', $data);
As far as I know the above code will load login_form.php inside the auth folder properly without HMVC. However with HMVC, I need the following code to get the view to load:
$this->load->view('auth/auth/login_form', $data);
Is there a setting that we should change so we dont have to refer to the view file by (module name)/(views folder name)/(view filename) ? Or is this perfectly normal and most people does it this way?
It seems troublesome that I have to add the module folder name 'auth' to every view() function call, and change all of them should I change the name of the module folder.
Assuming you're using Modular Extensions - HMVC:
If you have auth set up as a module already, you can just call:
$this->load->view('login_form', $data);
The file /views/login_form.php will be loaded from within the current module. This applies to models, language files, libraries etc. Think of the module as its own application, this is what you would normally do.
Additionally, to load a file from another module or a controller outside the module's directory, you can use $this->load->view('auth/login_form');
If the file is not found, it will check the other module paths including the default directory. This may or may not be the way other HMVC packages work, I'm not sure - but it's the way MX works.

In Symfony, in which directory do I put my custom class?

In my symfony application I would like to create custom php class. And access that class via back end and front end. Can someone show me which folder should I put that class and how to access it?
Thanks in advance!
You can put it in the /lib folder. There it'll be autoloaded by Symfony .
It's recommended to create subfolders in /lib to group classes/files by their function.
(for example a directory /lib/routing for classes that concern the routing).

Categories