Skip to content

Commit 1a4f788

Browse files
update
1 parent 592095d commit 1a4f788

File tree

1 file changed

+0
-77
lines changed

1 file changed

+0
-77
lines changed

Tests/view.php

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -38,80 +38,3 @@
3838
// $viewYield,
3939
// 'qwwe'
4040
// );
41-
42-
return;
43-
44-
// Set shared data using trait method
45-
// View::setShared('company', 'TameDevelopers');
46-
47-
// // Render a view if it exists
48-
// if (View::exists($layout)) {
49-
// echo View::renderPartial($layout, [
50-
// 'title' => 'Welcome',
51-
// 'user' => 'John Doe',
52-
// ]);
53-
// }
54-
55-
// Render with errors and old input
56-
$view = new View($layout, [
57-
// 'title' => 'Dashboard',
58-
]);
59-
// $view->withErrors(['email' => 'Invalid email'])->withOldInput(['email' => '[email protected]']);
60-
61-
62-
63-
// Render each item in a collection
64-
$users = [
65-
['name' => 'Alice'],
66-
['name' => 'Bob'],
67-
];
68-
echo View::renderEach('partials/user', $users);
69-
70-
// Use layout and sections
71-
$view = new View($layout, []);
72-
$view->setLayout('main');
73-
$view->section('header', '<h1>Header Section</h1>');
74-
echo $view->yieldSection('header');
75-
76-
// Add global variable
77-
View::addGlobal('theme', 'dark');
78-
79-
// Register a custom directive (example)
80-
View::registerDirective('uppercase', function($value) {
81-
return strtoupper($value);
82-
});
83-
84-
// Conditionally render a view
85-
if ($showProfile = true) {
86-
echo View::renderIf($showProfile, 'partials/profile', ['user' => 'Jane']);
87-
}
88-
89-
// Cache a rendered view
90-
$content = View::cache($layout, ['title' => 'Cached Home'], 120);
91-
echo $content;
92-
93-
// SharedDataTrait advanced usage
94-
View::mergeShared(['foo' => 'bar', 'baz' => 'qux']);
95-
View::shareOnce('unique', 'value');
96-
View::shareIf(true, 'conditional', 'yes');
97-
View::lockShared('company');
98-
View::unlockShared('company');
99-
$count = View::sharedCount();
100-
echo "Shared data count: $count\n";
101-
102-
// Get shared data
103-
$shared = View::allShared();
104-
print_r($shared);
105-
106-
107-
$data = tview('tests.layout.if', [
108-
'name' => 'Peterson',
109-
'condition' => true,
110-
]);
111-
112-
// echo $data;
113-
114-
115-
dd(
116-
$data->render()
117-
);

0 commit comments

Comments
 (0)