Jump to content


Photo

Field Name case sensitivity makes sense but tripped me up

tripwire

  • Please log in to reply
2 replies to this topic

#1 alanfluff

alanfluff

    Sr. Member

  • Members
  • PipPipPipPip
  • 405 posts
  • 118

  • LocationOttawa, Canada

Posted 01 May 2012 - 02:04 PM

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 ;))

#2 renobird

renobird

    Sr. Member

  • Members
  • PipPipPipPip
  • 374 posts
  • 237

  • LocationGainesville, Florida

Posted 01 May 2012 - 07:15 PM

Alan,

Made that one a few times myself. Mostly when I get an itchy pinky finger and end up capitalizing something unintentionally.

:)

#3 alanfluff

alanfluff

    Sr. Member

  • Members
  • PipPipPipPip
  • 405 posts
  • 118

  • LocationOttawa, Canada

Posted 07 May 2012 - 02:16 PM

Hehe ;) I wish I had that excuse, mine was lack of synaptic activity.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users