Advertisement
denis-skripnik

golos-site/content.php

Jan 11th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. require 'vendor/autoload.php';
  4.  
  5. use GrapheneNodeClient\Commands\CommandQueryData;
  6. use GrapheneNodeClient\Commands\DataBase\GetContentCommand;
  7. use GrapheneNodeClient\Connectors\WebSocket\GolosWSConnector;
  8.  
  9. $commandQuery = new CommandQueryData();
  10.  
  11.  
  12. if ($_GET['page'] == true) {
  13. $data = ['golos-site',$_GET['page']]; // Делаем так, чтобы подгружались данные страницы, содержащей permlink из ?page=
  14.  
  15. $commandQuery->setParams($data);
  16.  
  17. $connector = new GolosWSConnector();
  18.  
  19. $command = new GetContentCommand($connector);
  20.  
  21. $res = $command->execute($commandQuery);
  22.  
  23. echo '<h1>'.$res['result']['title'].'</h1>'; // Заголовок
  24. echo $res['result']['body']; // Контент
  25. } else { // Главная
  26. $data = ['golos-site','glavnayaglavnaya']; // Делаем так, чтобы подгружались данные главной страницы
  27.  
  28. $commandQuery->setParams($data);
  29.  
  30. $connector = new GolosWSConnector();
  31.  
  32. $command = new GetContentCommand($connector);
  33.  
  34. $res = $command->execute($commandQuery);
  35.  
  36. echo '<h1>'.$res['result']['title'].'</h1>'; // Заголовок
  37. echo $res['result']['body']; // Контент
  38. }
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement