Portál AbcLinuxu, 13. listopadu 2025 09:30
$arr['title'][0] = 'text'; $arr['page'][0] = 'text'; $arr['page'][1] = 'text'; $arr['page'][2] = 'text'; $arr['title'][1] = 'text'; $arr['ul'][0][0] = 'text'; $arr['ul'][0][1] = 'text'; $arr['ul'][0][2] = 'text'; $arr['title'][2] = 'text'; $arr['ul'][1][0] = 'text'; $arr['ul'][1][1] = 'text'; $arr['ul'][1][2] = 'text'; $arr['ul'][1][3] = 'text';
{
"title": "My Page",
"sections":
[
{
"title": "First section",
"text": "Bla bla bla bla"
},
{
"title": "Second section",
"text": "Bla bla bla bla"
},
{
"title": "Third section",
"text": "Bla bla bla bla"
}
],
"author": "J. Random Author",
"date": 1398525291
}
a jak to prosím vypíšu ve třídě View? Je to celé? To je pole? Díky
array(
"title" => "My Page",
"sections" => array(
array(
"title" => "First section",
"text" => "Bla bla bla bla"
),
array(
"title" => "Second section",
"text" => "Bla bla bla bla"
),
array(
"title" => "Third section",
"text" => "Bla bla bla bla"
)
),
"author" => "J. Random Author",
"date" => time()
)
for ($i = 0; $i < 13; $i++)
$arr[] = 'text';
Slova "title", "ul" apod. si nechej do vieweru. Model vůbec nemá tušit, k čemu ta data použiješ - jestli do HTML nebo třeba do LaTeXu.
".
model namá obsahovat htmlToto je zcela špatně. Pointa není v použitém jazyku, ale v rozdělení aplikace do specializovaných vrstev, které spolu komunikují jen na explicitně uvedených místech. Tím se zabrání kombinatorické explozi počtu interakcí mezi částmi programu (tj. rozdíl v práci na programech o 10k a 100k řádcích je jen malý).
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.