03.12.2015 Views

laravel4cookbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

File-Based CMS 320<br />

68 if (count($parts) > 1)<br />

69 {<br />

70 $meta = $parts[0];<br />

71 $template = $parts[1];<br />

72 }<br />

73<br />

74 return [<br />

75 "meta" => $meta,<br />

76 "template" => $template<br />

77 ];<br />

78 }<br />

79<br />

80 public function parseMeta($meta)<br />

81 {<br />

82 $meta = trim($meta);<br />

83 $lines = explode("\n", $meta);<br />

84 $data = [];<br />

85<br />

86 foreach ($lines as $line)<br />

87 {<br />

88 $parts = explode("=", $line);<br />

89 $data[trim($parts[0])] = trim($parts[1]);<br />

90 }<br />

91<br />

92 return $data;<br />

93 }<br />

94 }<br />

.<br />

This file should be saved as workbench/formativ/cms/src/Formativ/Cms/Engine/Blade.php.<br />

The only difference can be found in the argument names (to bring them more in line with the rest<br />

of the class) and integrating the meta methods into the render() method.<br />

Next up is layout controller class:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!