search
HomeBackend DevelopmentPHP Tutorialoops jaime pas langlais openPNE common methods sharing

Copy the code The code is as follows:


'asdfgasgsad'));?>This sentence means to include '_sidemenu.php' and pass a series of parameters to its page,' _sidemenu.php' page can directly use the value in the $form variable
op_include_box('vote_question_create_box','asdfasdf',array('title'=>'Create question ','moreInfo'=>array('Create question',link_to('Create question 2','@my_index'))));
?>
op_include_box('vote_question_create_box',get_slot( 'pager'),array('title'=>'Create question','moreInfo'=>array('Create question',link_to('Create question 2','@my_index'))));
? >
'vote_question_create_box' is just a mark, 'asdfasdf' or get_slot('pager') is the information to be output to the title on the page (to include slot in this method, you can only use get_slot () You cannot use include_slot(),
To include slots in the page, you must use include_slot())
The key value name title in the third array parameter is fixed, it is the title displayed in the section 'vote_question_create_box', followed by The 'moreInfo' key name is also a fixed key value, and the array corresponding to the displayed content is a list of displayed content
Set a slot paragraph


Includes the specified slot paragraph. The set slot paragraph must be included to be displayed on the page
op_include_form('vote_question_from',$form,array('title'=>'Edit question','url'=>url_for('@vote_update?id='.$form->getObject()- >getId()),));
?> Contains a form object, 'vote_question_from' is the identification name, $form is the form object passed by the corresponding action, and the third array parameter title key value and url key value are Fixed, corresponding to the displayed title name and form submission path
The corresponding action content is
public function executeEdit(sfWebRequest $request){
$object = $this->getRoute()->getObject() ;
//If it is not the author, 404 is displayed on the screen
$this->forward404Unless($this->getUser()->getMemberId() == $object->getMemberId());//$object- >getMemberId() is the member_id field value of the record corresponding to the passed id value
$this->form = new VoteQuestionForm($object);
//Access this action path http://localhost/openpne/ web/vote/edit/1
}
?>
Hyperlink used to page forward and backward during paging
$pager $this->pager from the action = Doctrine::getTable('VoteQuestion')->getListPager($request->getParameter('page'));
Content in the getListPager() method of the PluginVoteQuestionTable class↓
class PluginVoteQuestionTable extends Doctrine_Table
{
public function getListPager($page = 1,$size = 20)
{
$query = $this->createQuery()->orderBy('updated_at DESC') ;
$pager = new sfDoctrinePager('VoteQuestion',$size);//Create a paging object for a certain table and pass a value of how many records to display on each page
$pager->setQuery($query);//Pass A query statement object
$pager->setPage($page);//Suppose the number of pages displayed is returned
$pager->init();
return $pager;
}
}
?>
Corresponds to the foreground page's iteration of the paging result set
getResults() as $item): //Use the openPNE paging mechanism to obtain the specified paging result set and iterate through each page A record?>


getUpdatedAt(),'f') //'f' represents a display format?>
getTitle(),count($item->getVoteAnswers())),'@vote_show?id='.$item->getId()) ?> ;



getId()) ?>Equivalent tosdsfg< ;/a>
The table name is in camel case and underlined in the database, and the field name is also the same
Linked
Even if you don’t use the method, you can directly write the ==== module name/ after the action="This can directly write web/ Action name ==== or the path behind the web set in the route"
$this->tasksObject in the action = $this->getRoute()->getObject();
$this-> ;getRoute()->getObject();//Get the information object in the table corresponding to the passed id parameter value. You can get the field value through get+field name(), such as $tasksObject-getId() on the page. ;
As for how to determine which table is obtained, it is determined when setting the action route through the routing class. The vote_question table is determined in the following example
Example
class opVotePluginFrontendRouteCollection extends sfRouteCollection
{
public function __construct(array $options)
{
parent::__construct($options);
$this->routes = array(
'vote_edit' => new sfDoctrineRoute(
'/vote/edit/:id',
array(' module' => 'vote', 'action' => 'edit'),
array('id' => 'd+', 'sf_method' => array('get')),
array( 'model' => 'VoteQuestion', 'type' => 'object')
),
);
}
}
?>

The above introduces the common method sharing of oops jaime pas langlais openPNE, including the content of oops jaime pas langlais. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
11 Best PHP URL Shortener Scripts (Free and Premium)11 Best PHP URL Shortener Scripts (Free and Premium)Mar 03, 2025 am 10:49 AM

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Introduction to the Instagram APIIntroduction to the Instagram APIMar 02, 2025 am 09:32 AM

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Working with Flash Session Data in LaravelWorking with Flash Session Data in LaravelMar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

Simplified HTTP Response Mocking in Laravel TestsSimplified HTTP Response Mocking in Laravel TestsMar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Build a React App With a Laravel Back End: Part 2, ReactBuild a React App With a Laravel Back End: Part 2, ReactMar 04, 2025 am 09:33 AM

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

cURL in PHP: How to Use the PHP cURL Extension in REST APIscURL in PHP: How to Use the PHP cURL Extension in REST APIsMar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

12 Best PHP Chat Scripts on CodeCanyon12 Best PHP Chat Scripts on CodeCanyonMar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Announcement of 2025 PHP Situation SurveyAnnouncement of 2025 PHP Situation SurveyMar 03, 2025 pm 04:20 PM

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!