0

I am trying to open a yii2 view page by calling folder name

http://localhost/xyz/

I am a fresh beginner of this framework, don't know is it possible or not. That thing is not working with me. I have created the connection using cmd and it works fine. But whenever I close the cmd the page does not open, seems like I need to keep the cmd running to view the page. I just want to know that is there any default controller to change the view process.

Sujal Patel
  • 2,444
  • 1
  • 19
  • 38
Rajesh Dey
  • 153
  • 2
  • 13
  • what do you mead with " whenever I close the cmd " ? yii2 work normally with an url call .. show use what you call "cmd" . – ScaisEdge Aug 22 '17 at 11:26
  • http://www.yiiframework.com/doc-2.0/guide-start-installation.html with this url I tried to run yii2. when I write `php yii serve`, the view page opens on `localhost:8080` @scaisEdge. – Rajesh Dey Aug 22 '17 at 11:29
  • this mean that you have not a local web server installed and are using a php server ? if so obviusoly you just start the server for use yii2 but if you have already an local wheb server you can avoid this php command for server – ScaisEdge Aug 22 '17 at 11:33
  • how can i run it on my local server, wamp is already installed on my system.. plz guide me.. – Rajesh Dey Aug 22 '17 at 11:35
  • then type the url `http://localhost/ your_path/your_application_di`r .. in your browser ... eg : `http://localhost/xyz/` – ScaisEdge Aug 22 '17 at 11:36
  • I have tried this one i think, `localhost/main folder` that contains whole yii contents. and it is my root directory. when I run it on browser it displays all the folder contents. – Rajesh Dey Aug 22 '17 at 11:41
  • 1
    try `localhost/main/web/index.php` – ScaisEdge Aug 22 '17 at 15:44
  • thanks @scaisEdge, xcatly I was looking for it. – Rajesh Dey Aug 23 '17 at 04:31

2 Answers2

1

As I know there are 3 differents solution for do it:

  1. Follow the official tutorial here:

  2. the most simple way, if you are using basic template, is just to move all contents (folders and files ) from web folder to the project path and change the paths from index.php

  3. follow this other tutorial ( first answer ), it is for advance template

0

Your explanation is kinda confusing, it's not clear what are you asking at all. For my part, I say to you that every time you enter to your "web" you will land in the index.php.

What you could do to go to the folder you want is create an action which redirects to the view you want to access, remember that yii works totally with actions (MVC)

(I suppose is not the most accurate answer but as I said I don't know for sure what do you want to know)

Juli15
  • 411
  • 7
  • 17
  • I know whenever i hit action followed by controller it calls the view, and in Yii 1.1 it calls by default site/index, but in yii2 i cant call it using default controller. sorry I cant ask actually what I actually want – Rajesh Dey Aug 22 '17 at 12:08