Saving a PHP script separately from the user interface

I have php scripts that do things like register, login, upload. I would like to save the HTML in a separate file, so I will say that I am doing a client desktop, I can just use php files to register the register, etc.

Basically, to say that the front end is an HTML client or desktop, and then only one server, php.

Is it possible?

EDIT: Maybe something like ASP.net is more suitable for this?

+3
source share
6 answers
+6

? - .

, ( -)

<?
include 'config.php';
$data=db_query("SELECT * FROM data",3);
display($data,"users_list.tpl");
?>

display(). , . HTML, JSON, .

<?
if ($destination == 'desktop') echo json_encode($data);
else include $template;
?>

users_list.tpl

<a href="?id=0">Add item</a>
<? foreach ($data as $row): ?>
<li><a href="?id=<?=$row['id']?>"><?=$row['name']?></a>
<? endforeach ?>

. echo $row['name']; -.

+1

, , MVC (Model-View-Controller). , ​​ CodeIgniter, Kohana, CakePHP Symfony. , CodeIgniter .

0

Agiletoolkit - , MVC , JQuery , - CRUD .

, , php, - , .

I cannot comment on other frameworks since I used them, but as an experienced programmer in non-web development areas, I prefer the agiletoolkit approach against raw php encoding. I do not want to invent many things, such as security, ajax, etc. - I just want to start developing the application and have easy-to-maintain code at the end of development.

If this is what you are looking for, check out this php framework with jquery integration

0
source

Source: https://habr.com/ru/post/1740561/


All Articles