page&post in index

viriisxp
Sr. Bludit
Posts: 33
Joined: Sat Jul 02, 2016 6:01 pm

Bug for my original request ?
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

I think so... I have to try it.
viriisxp
Sr. Bludit
Posts: 33
Joined: Sat Jul 02, 2016 6:01 pm

Ok i Will test when i come back home
viriisxp
Sr. Bludit
Posts: 33
Joined: Sat Jul 02, 2016 6:01 pm

ok , i change this on my api file , that's ok, into the admin page, it's working.

when i put :

Code: Select all

                <?php

$url = 'http://www.rotaryclub-balma.fr/api/show/page/notrehistoire';

$jsonData = file_get_contents($url);

$data = json_decode($jsonData, true);

foreach($data as $page) {

    echo $page['title'];


    echo '<br>';
}

?>
into my home.php , he say :

Code: Select all

Warning: Illegal string offset 'title' in /home/vivreune/www/rotaryclub-balma/bl-themes/pure/php/home.php on line 64
n

Warning: Illegal string offset 'title' in /home/vivreune/www/rotaryclub-balma/bl-themes/pure/php/home.php on line 64
N

Warning: Illegal string offset 'title' in /home/vivreune/www/rotaryclub-balma/bl-themes/pure/php/home.php on line 64
<

Warning: Illegal string offset 'title' in /home/vivreune/www/rotaryclub-balma/bl-themes/pure/php/home.php on line 64
<

Warning: Illegal string offset 'title' in /home/vivreune/www/rotaryclub-balma/bl-themes/pure/php/home.php on line 64

Notice: Uninitialized string offset: 0 in /home/vivreune/www/rotaryclub-balma/bl-themes/pure/php/home.php on line 64


Warning: Illegal string offset 'title' in /home/vivreune/www/rotaryclub-balma/bl-themes/pure/php/home.php on line 64
2

Warning: Illegal string offset 'title' in /home/vivreune/www/rotaryclub-balma/bl-themes/pure/php/home.php on line 64
h
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

I have the same error. :-(
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

The foreach code is when you have more than 1 page or post, in the case of 1 post or page try this:

Code: Select all

<?php

$url = 'http://www.rotaryclub-balma.fr/api/show/page/notrehistoire';

$jsonData = file_get_contents($url);

$data = json_decode($jsonData, true);

echo $data['title'];

?>
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Yes, this works! Thought it should also with the loop. :oops:
viriisxp
Sr. Bludit
Posts: 33
Joined: Sat Jul 02, 2016 6:01 pm

OMG of course it's was the foreach...

i'm stupid ! lol

thx for all of this , and thx for your system. i like it !
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Problem trying what?
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
mary
Jr. Bludit
Posts: 4
Joined: Mon Aug 08, 2016 11:59 am

Hi,
here is a little tutorial to do it, https://docs.bludit.com/en/misc/embed-b ... my-website

You need to have Bludit v1.4 and the plugin API enabled.
Post Reply