简体   繁体   中英

Laravel, can't find true source of html

Laravel 4.2, Ubuntu 14.04. My apologies as I am being asked to make a small HTML change using a framework that I have little experience with.

I am to change a date (just text) from 2014 to 2015, and recursive grepping has revealed two files which contain what seems to be the existing html:

app/views/public/base/footer.blade.php

and also a file which is obviously generated

../shared/storage/views/9c6aa15f7975c94aeb3aadfdaa9a8f83

That second files DOES enact my changes when edited (editing the first file crashes the site), but clearly this isn't how it should be done. What is generating this file!?

I do have some understanding of the route > controller > blade sequence. An incoming root URL request goes like this:

app/routes.php 
Route::get('/', 'HomeController@show' );

which calls

app/controllers/HomeController.php
public function show()
{
  // ... omitted for brevity 

  return View::make('public.pages.home')->with(compact( 'home', 'popular', 'featured' ));
}

which calls this Blade file, which I continue to follow since it doesn't contain anything about the footer yet

app/views/public/pages/home.blade.php
@extends( 'public.base.html' )

which extends

app/views/public/base/html.blade.php
@include( 'public.base.footer' )

^ there it is! My footer! The included file and target html is this:

app/views/public/base/footer.blade.php
<a href="http://www.glpublishing.com/digitaleditions/aio14/index.html" target="_blank">

God have mercy on my soul I just need to change aio14 to aio15. Doing so, however, will take the whole site down: white screen with an exception error. Adjusting the timestamp to its original fixes the problem (using touch -r) but the altered text doesn't take anyway.

I'm left having to edit that bizarre generated file which I know is poor form. Any help is appreciated.

Without seeing all your code I will not be able to answer this directly, but I might be able to provide some insight. I have a hunch that you might have a separate problem in that view file (app/views/public/base/footer.blade.php) which is unrelated to the change that you are making to the link.

The file labeled ../shared/storage/views/9c6aa15f7975c94aeb3aadfdaa9a8f83 is a cached file generated by Laravel, which is likely the one generating your html to be sent to the browser at the moment. When you edit that file directly your change is working because there is nothing wrong with the cached file. However, when you change the original file, it is causing Laravel to update the cache with that file and thus bringing with it the error that is causing the site to crash.

To test this theory, I would recommend making the change in the original file (app/views/public/base/footer.blade.php) as you have done before and then debugging the issue that arises - remembering that it might have nothing to do with the change you are making.

I would definitely leave the ../shared/storage/views/9c6aa15f7975c94aeb3aadfdaa9a8f83 file alone, since editing this is not going to be a reliable solution in the long run as it will be overwritten when the cache updates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM