关于模板中踊跃获取数据,大家有什么好的方法
关于模板中主动获取数据,大家有什么好的方法
为了防止程序中提供数据,而模板中没有使用到的情况发生,同时也为了更好的让制作模板的人自由发挥,做到根据模板需要获取数据,以往的方式,我是编写了很多标签函数,供模板调用,直接在模板中插入标签函数即可获取数据,最近把程序改成框架模式开发了,将原来的标签函数写在Tag类库中,调用的时候用Tag::func()方式当然也是没有问题的,但是这样的话,增加的不同的模块,需要显示的部分,都要添加到这个类库中,不方便扩展,所以想把显示部分也直接写在对应的模块的模型类中,而在Tag类库中增加一个方法,实现根据模型名称与方法名称调用不同模型的方法,这里有个问题,类里面方法的调用有两种:1是作用域方式,2是对象方式,有没有办法做到,自动判断能否使用作用域方式调用,如果不能的话,再用对象方式调用?
------解决方案--------------------
做到根据模板需要获取数据
我就知道这个需求是普遍的http://topic.csdn.net/u/20120522/14/51e081ae-baa8-47ea-9257-268c4ca3be60.html

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
