This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
daftspunky
Handy tip, if you want to redirect an old sites URLs so they no longer have htm or html suffixes on them.
Example layout content:
description = "Default layout"
==
<?
function onStart()
{
// Remove '.html' from addresses
$url = Request::url();
if (ends_with($url, ['.html', '.htm'])) {
$url = str_replace(['.html', '.htm'], '', $url);
return Redirect::to($url, 301);
}
}
?>
==
<!DOCTYPE html>
[...]
Akhil
Redirection is working perfectly but i am no able to get the variable
$this->posts->tvseasons->tvepisodes->tvvideos->alias;
Its giving error
Undefined property: Illuminate\Database\Eloquent\Collection::$tvepisodes
use Akhil\Vh1\Models\TvShow;
function onStart() {
$show_id = $this->Param('show_id');
$season_id = $this->Param('season_id');
$episode_id = $this->Param('episode_id');
$this['show_id'] = $show_id;
$this['season_id'] = $season_id;
$this['episode_id'] = $episode_id;
$this['posts'] = TvShow::isPublished()->where('alias', '=', $show_id)
->with(array('tvseasons' => function($s){
$s->isPublished()->where('alias', '=', $this->season_id)
->with(array('tvepisodes' => function($e){
$e->isPublished()->where('alias', '=', $this->episode_id)
->with(array('tvvideos' => function($f){
$f->where('published', '=', 1)
->where('is_deleted', '=', 0)
->orderBy('id', 'asc')
->skip(0)->take(1);
}))->skip(0)->take(1);
}))->skip(0)->take(1);
}))->first();
//echo '<pre>';print_r($posts->tvseasons->tvepisodes);
$this['posts'] = $this->posts->tvseasons->tvepisodes->tvvideos->alias;
//$url = Request::url();
//return Redirect::to($url.'/hello', 302);
}
Last updated
1-3 of 3