How to configure internal url's content on Symfony - php

I am new to Symfony and I am trying to understand how a Symfony project works. Right now I am trying to change the content of an internal url. For example, in the layout.php file, I can put a sentence like:
Suecia
This works fine, when I press 'Suecia' "Button" it changes the content, and it adds viajesDeusto/new to the url. My question is, where can I change the content that the "viajesDeusto/new' url displays?
Thanks a lot

If you split the url in your url_for() function it breaks out to MODULE/ACTION
So go into your app (%SF_ROOT_DIR%/apps/%APP_NAME%)
inside that folder you have a modules folder
inside that you have the module name
inside that you have an actions folder and a templates folder
the actions folder is where your code to retrieve/process data resides
the templates folder is where the presentation code resides
For instance, if your app is called frontend the location of the code is:
%SF_ROOT_DIR%/apps/frontend/modules/viajesDeusto/actions
%SF_ROOT_DIR%/apps/frontend/modules/viajesDeusto/templates
This is the standard setup for syfony 1.x apps

Related

How to set up references between twig file and assets files(CSS, Js) in Silex?

Before I start I want to say that I am new to working with this framework and some of its features I do not fully understand.
So, I have the following structure:
Desired assets folder location:
web
assets
css
file.css
Current twig views location:
src
App
views
file.html.twig
So the "web" and "src" are on the same level. Now how can I link the CSS for the "file.html.twig"? I also read the Silex cookbook (http://silex.sensiolabs.org/doc/cookbook/assets.html) but I don't quite understand where do I have to write every step presented there. Thank you.
The app.request.basepath is a link the base path of your application, e.g. the public (accessible) php file where you instanciate and run you Silex application.
Mine is an index.php in /web, so writing {{ app.request.basepath }}/assets/css/file.css is OK and leads to 'web/assets/css/file.css', but my guess is thaht you did not put your main index.php file in /web directory (maybe in a sub-directory). You should check that first.
I'm quite new to Silex as well so you should take my words with caution, but taking a look at it doesn't cost anything after all ;)

Bypass Symfony framework to display folder content

First of all. I haven't got any knowledge about Symfony. I just have to do a few modifications to an existing site quick and dirty. Now here is the case.
I need to "bypass" the Symfony framework to access static content in a folder e.g. (domain.com/folder).
This folder contains index.html and all the needed images, css, js etc. It also contains sub pages like (domain.com/folder/sub.html, domain.com/folder/sub2.html etc.). These sub pages are accessible thourgh domain.com/folder/index.html.
How can I do this?
SOLVED: (by user3749178)
Put you folder under /web. And a note for anyone else -> you also have to reference the file name.
domain.com/folder/ -> does not work
domain.com/folder/index.php -> works
Put you folder under /web. Everything what is in your /web directory is visible via http.

Yii2 - URL for basic application template

I have just installed the Yii2 Basic Application Template using Composer.
This is now accessible on my localhost machine at the following URL:
http://localhost/basic/web
In Yii 1.1, it was possible to access a web application by simply going to :
http://localhost/basic
Having done some reading, it appears the only way to achieve the above is to create a new Apache vhosts entry. Whilst this is fine for one or two sites, if like myself you are working on new sites all the time, it is a bid tedious to have to set up vhosts for each and every site.
I have tried creating a .htaccess file to redirect all requests to web/index.php but this does not work. Is this at all possible to do in Yii2?
Move all the content in the /basic folder to eg. /basic-yii instead. Then take the /basic/web folder (now /basic-yii/web) and put all it's content into the /basic folder. Then adjust the paths for the require() calls in /basic/index.php to correctly point to autoload.php, Yii.php and web.php.

controller's view inside a child folder is not rendering on web hosting server PHP

I have a controller name OrderContoller. The controller class reside in Controller folder.It's view "servicetype.php" reside in child folder(order).
The "servicetype" render a page register.php which reside in child folder(pages) of order folder.
The code for rendering the register page written in servicetype page is :
$this->partialRender('pages/register',.....);
The interesting part is that it was working fine on my local machine using wamp but when i deployed it on Web hosting server "HostaGator".
It displays an error on this partialRender function line that "pages/register" file does not exist.
when i move this file from pages folder to order folder(parent folder) and change the location .
$this->partialRender('register',.....);
then it works fine.
Please tell me what is the problem, there are many views where doing partial render from child folders i dont want to change the locations on code,please help me out.
Make sure the permissions are correct in the new environment - is it possible that folder is not readable by the web server?
You should also not necessarily be using a /, it's usually better to use the PHP Global Constant DIRECTORY_SEPARATOR if you know you will be on a host you don't control.

Best way to organize a website root

I have made a website (WP based) and put every stuff inside the /site folder.
I did that, thinking of creating "custom" systems, and putting each one inside a folder, so for example: /promo would go to something else than the website...
But, I have tried with both .htaccess redirect and PHP location redirect, and when I try to "share" the website, without it's /site folder included, Facebook doesen't detect's the site meta...
Also, is it a problem for google, to use redirect's when accessing the website without the /site WP home folder? I mean, a guy comming from a www.onesite.com would have it's "referer" header as onesite, or mysite?
Thanks
I feel like you're creating your own problems. Just put WordPress in document root and don't bother with rewriting to a subdirectory. WordPress won't delete any custom files or folders when updating.
If you have some custom part that you want to reach through http://www.example.com/promo. Put it in the promo folder under the document root.
If want to reach the custom part through http://promo.example.com, just create new virtual host.

Categories