Jayson
Jayson

Reputation: 2193

how to share pariail templates in different modules

for example, I hava a partial template named _header.php, I want to use it in both Post, Forum module, How can i write renderPartial(), to load this template.

Upvotes: 2

Views: 926

Answers (1)

user776067
user776067

Reputation: 166

placed your partial view to app layouts dir.

<?php
 $this->renderPartial('//_header.php');
?>

absolute view within a module: the view name starts with a single slash '/'. In this case, the view will be searched for under the currently active module's view path. If there is no active module, the view will be searched for under the application's view path.

absolute view within the application: the view name starts with double slashes '//'. In this case, the view will be searched for under the application's view path. This syntax has been available since version 1.1.3.

reference getViewFile()

Upvotes: 4

Related Questions