Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help] setVar('body', $view, 'raw') #1000

Closed
BI7PRK opened this issue Apr 25, 2018 · 3 comments
Closed

[Help] setVar('body', $view, 'raw') #1000

BI7PRK opened this issue Apr 25, 2018 · 3 comments

Comments

@BI7PRK
Copy link

BI7PRK commented Apr 25, 2018

I created a account on forums, but i donnt know why cannt post thread. i have a problem:

Layout file:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>test-{title}</title>
  <style> 
    {styles}
  </style>  
  </head>
  <body>
      <div class="container-fluid">
        {body}
      </div>
    <script>
     {footscript}
    </script>    
  </body>
</html>

View code:

<div class="wrap">
<ul>
				<?php foreach ($append as $item): ?>
				<li><?=$item['id'] .'='.$item['name']  ?></li>
				<?php endforeach;?>
			</ul>
</div>

Controller code:

$append = ['append' => [
	['id' => 1, 'name' => 'fsa' ],
	['id' => 2, 'name' => 'fasdf2' ],
	['id' => 3, 'name' => 'fsda3' ]

]];
$bodyview = view('welcome', $append);


$tpldata = [
	'title'=> 'page title', 
	'styles' =>'.div{ font-size:1.1em; }', 
	'footscript' =>'//var b = 1;', 
	'envir' => ENVIRONMENT 
];

$parser = \Config\Services::parser();

echo $parser->setData($tpldata)
	-> setVar('body', $bodyview, 'raw')
	-> render('layout/default');

But... page body is:

default

what should I do? thank you very much.

@lonnieezell
Copy link
Member

When a person first signs up on the forums, they have to get their first couple of posts approved to help us combat spam. I went to the forums to approve your post and answer there, but I don't see any posts that need approving. What happens when you try to post there?

@BI7PRK
Copy link
Author

BI7PRK commented Apr 26, 2018

my account has been verified by email. but I don't see the button/links to post in the forum.

@jim-parry
Copy link
Contributor

Inside any of the subforums, on the far right of the pagination toolbar, there is a "Start new topic" button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants