简体   繁体   English

适应性和index.phtml模板

[英]Apigility and index.phtml template

I am trying to create a index.phtml page to my RESTful Apigility API. 我正在尝试为我的RESTful Apigility API创建index.phtml页面。 Steps i have taken is 1) Create a DB connected API any given it route "account" 2) Access the account API on /account with postman and got HAL and JSON to response to work 3) Create a new "Selector" under content negotiation with 3 view models. 我所采取的步骤是1)在给定路由“账户”的情况下创建一个与数据库连接的API 2)使用邮递员访问/ account上的账户API,并获得HAL和JSON来响应工作3)在内容协商下创建一个新的“选择器” 3个视图模型。 "ZF\\ContentNegotiation\\ViewModel", "ZF\\Hal\\View\\HalJsonModel" and "Zend\\View\\Model\\ViewModel" 4) Selected the newly created selector in the accounts API 5) Created a index.phtml under Account/view/index.phtml with code " “ ZF \\ ContentNegotiation \\ ViewModel”,“ ZF \\ Hal \\ View \\ HalJsonModel”和“ Zend \\ View \\ Model \\ ViewModel” 4)在帐户API中选择了新创建的选择器5)在Account / view /下创建了index.phtml index.phtml,代码为“

Test 测试

" 6) Added “ 6)已添加

 'view_manager' => array( 'template_path_stack' => array( 'account' => __DIR__ . '/../view', ), ), 

to module.config.php 到module.config.php

7) Using postman and accessed /account with Accept application/json // works Accept text/html // don't work 7)使用邮递员并通过Accept application / json //访问/ account //可以接受text / html //不起作用

Would be great if someone could lend a hand to get a index.phtml template to work with a restful DB connect API 如果有人可以帮助获得index.phtml模板以与宁静的数据库连接API一起工作,那就太好了

If you want to use ViewModel you should choose RPC API . 如果要使用ViewModel ,则应选择RPC API You can create RPC API with following this documentation 您可以按照以下文档创建RPC API

https://apigility.org/documentation/intro/getting-started#create-an-rpc-service https://apigility.org/documentation/intro/getting-started#create-an-rpc-service

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM