# Dashes in variables

**URL:** <https://forum.getkirby.com/t/dashes-in-variables/6552>\
**Category:** Questions\
**Tags:** v2\
**Created:** [February 6, 2017, 3:40pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552 "2017-02-06T15:40:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dilby](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dilby/32/3221_2.png) [@dilby](https://forum.getkirby.com/u/dilby)\
**Post date:** [February 6, 2017, 3:40pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/1 "2017-02-06T15:40:51Z")

</div>

Hi all -

I’ve created a page called ‘case-studies’ and getting the following error:  
“Fatal error: Call to a member function isErrorPage() on boolean in /var/sites/domain.co.uk/public\_html/kirby/kirby/kirby.php on line 333”

Something to do with how i use dashes, but not sure what is the correct method.  
My content folder is called ‘case-studies’ and inside is ‘case-studies.txt’

Where am I going wrong? Thanks!

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 6, 2017, 3:46pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/2 "2017-02-06T15:46:35Z")

</div>

> [@dilby](#):
>
> isErrorPage()

Have you renamed the error page folder? Dashes in file names shouldn’t be a problem, but if in doubt, just try to rename the folder, file and template names.

---

<div class="post-metadata">

**Author:** ![dilby](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dilby/32/3221_2.png) [@dilby](https://forum.getkirby.com/u/dilby)\
**Post date:** [February 6, 2017, 4:11pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/3 "2017-02-06T16:11:15Z")

</div>

Sorry texnixe, I’m not with you. I’ve renamed the files and folders to now have dashes and it works, so its definitely the dashes that are causing the issue. I’m just not sure how to allow them.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 6, 2017, 4:15pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/4 "2017-02-06T16:15:14Z")

</div>

I don’t think there’s an option for allowing dashes. I’m using dashes in filenames myself and have never ran into any issues, so that makes it bit difficult to reproduce.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 8, 2017, 8:11pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/5 "2017-02-08T20:11:11Z")

</div>

> [@dilby](#):
>
> My content folder is called ‘case-studies’ and inside is ‘case-studies.txt’

Have you checked if the error is caused by the folder name or by the name of the content file? Or both?

---

<div class="post-metadata">

**Author:** ![dilby](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dilby/32/3221_2.png) [@dilby](https://forum.getkirby.com/u/dilby)\
**Post date:** [March 9, 2017, 2:11pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/6 "2017-03-09T14:11:15Z")

</div>

Thanks so much for the reply and Im sorry for the lateness in mine. I tried installed the start kit and working from scratch, but everything works without a dash, but when I add the dash it stops working!

If I enable debugging, I’m told the issue is with this line from a snippe (the snippet basically loops in existing children, and is a duplicate of the showcase snippet:

`$case-studies = page('case-studies')->children()->visible();`

To me, the issue of the dash in the variable creates a syntax issue, but I don’t see any other way around it.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 9, 2017, 2:16pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/7 "2017-03-09T14:16:00Z")

</div>

Let me quote the docs:

> Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive.

> Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: ‘[a-zA-Z\_\x7f-\xff][a-zA-Z0-9\_\x7f-\xff]\*’  
> [PHP: Basics - Manual](http://www.php.net/manual/en/language.variables.basics.php)

So, no dashes, sorry 😉

You can use dashes in folder names, of course. In fact, Kirby creates folders with dashes, anyway, if you use multi-word titles.

---

<div class="post-metadata">

**Author:** ![dilby](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dilby/32/3221_2.png) [@dilby](https://forum.getkirby.com/u/dilby)\
**Post date:** [March 9, 2017, 3:38pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/8 "2017-03-09T15:38:31Z")

</div>

Thanks - so now I understand that in theory the dashes in a url come from the folder. However I’ve added these and it’s still broken. I’m being told that

```
<?php
$casestudies = page('casestudies')->children()->visible();
if(isset($limit)) $casestudies = $casestudies->limit($limit);
?>

```

is wrong

I’ve included a gif of my folder structure to ensure my naming in regards to dashes is correct. Basically I just want the dash in the url for standards purposes. Thanks so much!

[http://recordit.co/1CnKL9O73j](http://recordit.co/1CnKL9O73j)

---

<div class="post-metadata">

**Author:** ![bnomei](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bnomei/32/775_2.png) [@bnomei](https://forum.getkirby.com/u/bnomei)\
**Post date:** [March 9, 2017, 3:57pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/9 "2017-03-09T15:57:06Z")

</div>

- use a dash if needed as parameter for the page function. `page('case-studies')` since you refernce to a folder.
- do not use dashes in php vars since thats not possibe.
- you can name the var anything you want. it does not have to match the folder-name.

```auto
$casestudies = page('case-studies')->children()->visible(); // var without dash

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 9, 2017, 4:16pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/10 "2017-03-09T16:16:35Z")

</div>

As @bnomei already corrected, your variable may not have a dash in it, but your folder name does have a dash in it, so you have to use the dash in the `page()` helper.

---

<div class="post-metadata">

**Author:** ![dilby](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dilby/32/3221_2.png) [@dilby](https://forum.getkirby.com/u/dilby)\
**Post date:** [March 9, 2017, 5:32pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/11 "2017-03-09T17:32:39Z")

</div>

Thanks! You guys and gals are awesome!

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:50pm UTC](https://forum.getkirby.com/t/dashes-in-variables/6552/12 "2025-02-06T16:50:31Z")

</div>

Archived on February 6, 2025, 4:50pm UTC


