Jump to content

Field Name case sensitivity makes sense but tripped me up


alan
 Share

Recommended Posts

In case the mistake I just made helps anyone else...

I wanted to display a file on a page with a default install of PW. So I added a field of type 'file' and rather unimaginatively called it "Files".

Via the admin I then edited a page and added a file and description to a page and added:

foreach($page->files as $file) {
echo "<p>Test output: {$file->description}</p>";
}

to the template.

The result was nothing new displayed :/ Confused I tried lots of things, then wondered if by using the name "Files" for my field I had stumbled on a reserved word that didn't work.

Of course everyone will have seen my error, the field I added was "Files" and the field I am querying is "files".

Lesson well and truly learned (I hope ;))

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...