Download the PHP package hnrazevedo/viewer without Composer
On this page you can find all versions of the php package hnrazevedo/viewer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hnrazevedo/viewer
More information about hnrazevedo/viewer
Files in hnrazevedo/viewer
Package viewer
Short Description Tools for developing personal projects
License MIT
Informations about the package viewer
# Viewer @HnrAzevedo
The Viewer is a simple component of managing the MVC project visualization layer. It can be used individually statically or together as middleware. Its author is not a professional in the development area, just someone in the Technology area who is improving his knowledge.
O Viewer é um simples componente de administração da camada de visualização de projetos MVC. Ele pode ser utilizado de forma individualmente de forma estática ou em conjunto como middleware. Seu autor não é profissional da área de desenvolvimento, apenas alguem da área de Tecnologia que está aperfeiçoando seus conhecimentos.
Highlights
- Easy to set up (Fácil de configurar)
- Follows standard PSR-15 (Segue padrão o PSR-15)
- Composer ready (Pronto para o composer)
Installation
Viewer is available via Composer:
or in at terminal
Methods
Extensions
- View files: view.php
- Imported files: inc.php
Basic use
Return rendering
To return the content in a variable instead of being rendered, use the optional parameter of the render method
Para retornar em uma váriavel o conteúdo ao invés de ser renderizado, utilize o parametro opcional do método render
Data transfer between the view and the controller
Returning data in the view
The htmlspecialchars function is used by default as an escape to prevent XSS attacks.
É utilizado de forma padrão a função htmlspecialchars como escape para evitar ataques XSS.
Sintax:
Sintaxe:
To display information without space use the syntax:
Para exibir informações sem espace utilize a sintaxe:
HTML file example
Note: If there is no variable to replace the value defined in the view, the text will be visible
HTML file result example:
Returning object properties
IMPORTANT: to return any property of an object, the property must be public, to be returned with the "get_object_vars" function, or a function with the name "getVars" must be defined, returning an array with the properties that need to be executed __get.
Models\User.php
Example\User.php
default.view.php
Result of default.view.php
Import content within the view.
NOTE: File extension inc.php
NOTE: File path is from the defined view path in question
If the file is not found, in order to avoid a page break, a div results with an error message instead of include.
Caso o arquivo não seja encontrado, para não haver quebra de página, é resultado uma div com a mensagem de erro no lugar do include.
HTML compression
All code returned from a view or include is compressed. Thus, to avoid code problems, all comments are ignored when rendering the content.
Todo código retornado de uma view ou include é compressado. Com isto, para evitar problemas de código, todos os comentários são ignorados na renderização do conteúdo.
Source code
Rendered code
Support
Security: If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Se você descobrir algum problema relacionado à segurança, envie um e-mail para [email protected] em vez de usar o rastreador de problemas.
Credits
- Henri Azevedo (Developer)
License
The MIT License (MIT). Please see License File for more information.