Skip to content

Instantly share code, notes, and snippets.

@niklausgerber
Created January 16, 2012 13:07
Show Gist options
  • Save niklausgerber/1620782 to your computer and use it in GitHub Desktop.
Save niklausgerber/1620782 to your computer and use it in GitHub Desktop.
Problem with Variables
I would like to change this
$LOGIN_INFORMATION = array(
'username' => 'password'
);
into this
$LOGIN_INFORMATION = array(
$page->username() => $page->password()
);
so I can store that information in the txt file. I know that you can access the txt file over the server directory but that is not a big issue here since this is just a little protection for clients.
I am not that used to php yet so I am sure I was doing a rookie mistake.
Thanks for helping
Nik
@bastianallgeier
Copy link

This is a little tricky. All kirby variables are not just plain strings, but the array needs a plain string as key. So what you need to do is this:


$LOGIN_INFORMATION = array(
  (string)$page->username() => $page->password()
);

@niklausgerber
Copy link
Author

ah ok - great thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment