gaziks52 Posted February 9, 2009 Report Share Posted February 9, 2009 (edited) tikko sāku apgūt cakePHP ..... eju cauri Bloga tutoriālim un šo to nesaprotu.... tātad view/posts/index.ctp <h1>Blog Posts</h1> <?php echo $html->link('Add Post','/posts/add')?> <table> <tr> <th>Id</th> <th>Title</th> <th>Created</th> </tr> <?php foreach ($posts as $post): ?> <tr> <td><?php echo $post['Post']['id']; ?></td> <td><?php echo $html->link($post['Post']['title'],"view/".$post['Post']['id']); ?></td> <td><?php echo $post['Post']['created']; ?></td> </tr> <?php endforeach; ?> </table> un kad browserī atver ..../posts/index <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> CakePHP: the rapid development php framework: Posts </title> <link href="/cake_1_2/favicon.ico" type="image/x-icon" rel="icon" /><link href="/cake_1_2/favicon.ico" type="image/x-icon" rel="shortcut icon" /><link rel="stylesheet" type="text/css" href="/cake_1_2/css/cake.generic.css" /></head> <body> <div id="container"> <div id="header"> <h1><a href="http://cakephp.org">CakePHP: the rapid development php framework</a></h1> </div> <div id="content"> <table class="cake-sql-log" id="cakeSqlLog_12342209334990b785748cf0_72458746" summary="Cake SQL Log" cellspacing="0" border = "0"> <caption>(default) 2 queries took 3 ms</caption> <thead> <tr><th>Nr</th><th>Query</th><th>Error</th><th>Affected</th><th>Num. rows</th><th>Took (ms)</th></tr> </thead> <tbody> <tr><td>1</td><td>DESCRIBE `posts`</td><td></td><td style = "text-align: right">5</td><td style = "text-align: right">5</td><td style = "text-align: right">3</td></tr> <tr><td>2</td><td>SELECT `Post`.`id`, `Post`.`title`, `Post`.`body`, `Post`.`created`, `Post`.`modified` FROM `posts` AS `Post` WHERE 1 = 1 </td><td></td><td style = "text-align: right">4</td><td style = "text-align: right">4</td><td style = "text-align: right">0</td></tr> </tbody></table> no kurienes rodas tas kods, ja tajā view es pieliku tikai tabulu???? Edited February 10, 2009 by gaziks52 Link to comment Share on other sites More sharing options...
max Posted March 31, 2009 Report Share Posted March 31, 2009 Imho, as ir layout fails, kuraa tiek iekljauts view's. Uztaisi zem view/layouts/ failu default.ctp, samet iekshaa visu vajadziigo HTML'u (ar body, html tagiem utt), pa vidu echo $content_for_layout un viss buus ok. Link to comment Share on other sites More sharing options...
Recommended Posts