# Code stop working after changing php version

**URL:** <https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148>\
**Category:** Questions\
**Tags:** v2\
**Created:** [January 28, 2016, 5:26pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148 "2016-01-28T17:26:35Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![guidoferreyra](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/guidoferreyra/32/12544_2.png) [@guidoferreyra](https://forum.getkirby.com/u/guidoferreyra)\
**Post date:** [January 28, 2016, 5:26pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/1 "2016-01-28T17:26:35Z")

</div>

Hi everyone! Recently I changed the php version of my host to 5.5 in order to use oembed plugin but other part of my code stop working. Running locally with MAMP everything works great.

I’m very not with PHP, Could you help me please?

Here the code, thanks in advance.

```
<?php if(!$page->text()->empty()): ?>
    
    <div class="gallery">
        <?php foreach($page->text()->kirbytext()->split(',') as $tag): ?>
        <div class="gallery-cell">
            <?php echo $tag?>
        </div>
        <?php endforeach ?>
    </div>

<?php else: ?>
    <div class="gallery">
          <?php foreach($page->images()->sortBy('sort', 'asc') as $image): ?>
          <div class="gallery-cell">
            <img src="<?php echo $image->url() ?>" alt="<?php echo $page->title()->html() ?>">
          </div>
          <?php endforeach ?>
    </div>

<?php endif ?>

```

---

<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:** [January 28, 2016, 6:50pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/2 "2016-01-28T18:50:07Z")

</div>

First of all, you really should turn on debugging during development in your config.php:

```php
c::set('debug', true);

```

Secondly, this line:

```php
 <?php foreach($page->text()->kirbytext()->split(',') as $tag): ?>

```

should be replaced with this:

```php
 <?php foreach($page->text()->split(',') as $tag): ?>

```

---

<div class="post-metadata">

**Author:** ![guidoferreyra](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/guidoferreyra/32/12544_2.png) [@guidoferreyra](https://forum.getkirby.com/u/guidoferreyra)\
**Post date:** [January 28, 2016, 7:18pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/3 "2016-01-28T19:18:07Z")

</div>

thanks for the debug suggestion, but when I remove “-\>kirbytext()-\>” oembed doesn’t work. With $tag im referring to oembed links.

---

<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:** [January 28, 2016, 7:33pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/4 "2016-01-28T19:33:01Z")

</div>

Could you post your blueprint and what you have in your text field?

I think you’d better use a structure field with several url fields and then call the `oembed()` field method in your template on every URL as described in the oEmbed readme

Blueprint:

```nohighlight
fields:
  oembed_videos:
    label: Videos
    type: structure
    fields:
      video_url:
        label: Video URL
        type: url

```

In your template:

```auto
<?php if($page->oembed_videos()->isNotEmpty()): ?>
<?php $videos = $page->oembed_videos()->toStructure(); ?>
    <div class="gallery">
        <?php foreach($videos as $video): ?>
        <div class="gallery-cell">
            <?php echo $video->video_url()->oembed() ?>
        </div>
        <?php endforeach ?>
    </div>

<?php else: ?>
    <div class="gallery">
          <?php foreach($page->images()->sortBy('sort', 'asc') as $image): ?>
          <div class="gallery-cell">
            <img src="<?php echo $image->url() ?>" alt="<?php echo $page->title()->html() ?>">
          </div>
          <?php endforeach ?>
    </div>

<?php endif ?>

```

---

<div class="post-metadata">

**Author:** ![guidoferreyra](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/guidoferreyra/32/12544_2.png) [@guidoferreyra](https://forum.getkirby.com/u/guidoferreyra)\
**Post date:** [January 28, 2016, 7:42pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/5 "2016-01-28T19:42:35Z")

</div>

Thanks I will try it. With Structure field do you refer this?  
[https://getkirby.com/blog/structured-field-content](https://getkirby.com/blog/structured-field-content)

by the way here my blueprint  
[https://cloudup.com/c-qVOUFIQZA](https://cloudup.com/c-qVOUFIQZA)  
and the content in the field.

 ![](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/5/5d51b67b8983b5dbfa5e93731dda9bcf04b2c489.png)

---

<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:** [January 28, 2016, 7:44pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/6 "2016-01-28T19:44:53Z")

</div>

I posted a suggestion above. Pls. don’t post code as images.

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [January 28, 2016, 7:45pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/7 "2016-01-28T19:45:18Z")

</div>

> [@guidoferreyra](#):
>
> With Structure field do you refer this?

To [this](https://getkirby.com/docs/cheatsheet/panel-fields/structure), which is a Kirby 2 feature.

---

<div class="post-metadata">

**Author:** ![guidoferreyra](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/guidoferreyra/32/12544_2.png) [@guidoferreyra](https://forum.getkirby.com/u/guidoferreyra)\
**Post date:** [January 28, 2016, 8:07pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/8 "2016-01-28T20:07:32Z")

</div>

Oh! I didn’t saw it thank you.  
Sorry for the image 😟

I will try what are you suggesting. Thanks for your help!

---

<div class="post-metadata">

**Author:** ![guidoferreyra](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/guidoferreyra/32/12544_2.png) [@guidoferreyra](https://forum.getkirby.com/u/guidoferreyra)\
**Post date:** [January 29, 2016, 7:19pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/9 "2016-01-29T19:19:20Z")

</div>

Thank you this worked perfectly, know I understand better. Thanks again!

---

<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:** [January 29, 2016, 10:31pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/10 "2016-01-29T22:31:10Z")

</div>

You’re welcome 🙂

---

<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:58pm UTC](https://forum.getkirby.com/t/code-stop-working-after-changing-php-version/3148/11 "2025-02-06T16:58:07Z")

</div>

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


