[ROZŠÍŘENÍ] Díl 3.: Vlastní stránka

Uživatelský avatar
Otakar Pěnkava
Příspěvky: 526
Registrován: sob 25. říj 2008 16:17:14
Kontaktovat uživatele:

[ROZŠÍŘENÍ] Díl 3.: Vlastní stránka

Příspěvek od Otakar Pěnkava » úte 06. úno 2018 13:24:37

Ahoj uživatelé,
v minulém díle jsme si ukázali jak vytvořit šablony a eventy. To první ale pro naše účely zůstávalo nevyužité (naco tvořit šablonu, když nešla zobrazit), nyní tomu dáme smysl a ukážeme si jak to celé propojit. Dnešní díl bude o nastavení vlastní stránky, kdy si vytvoříme podstránku /auctions, kde budeme v budoucnu vypisovat seznam aukcí.

Najedeme si do složky našeho rozšíření (v mém případě ext/webdeal/auctions) a vytvoříme složky config a controller.

Složka config se bude skládat ze 2 souborů:
  • services.yml - slouží k nastavení proměnných a funkcí, ke kterým má mít stránka přístup
  • routing.yml - slouží pro tvorbu adresy podstránky

Kód: Vybrat vše

        class: webdeal\auctions\controller\auctions
            - '@config'
            - '@dbal.conn'
            - '@controller.helper'
            - '@request'
            - '@template'
            - '@user'
            - '%core.root_path%'
Pokud jste použili jiné jméno rozšíření, je potřeba změnit 2 a 3 řádek, kde webdeal nahradíte složkou, kterou máte v ext/, a auctions složkou, kterou máte v ext/vašerozšíření.

V rychlosti si to vysvětlíme. Tento soubor říká phpBB, že k souboru, který si umístíte do složky ext/webdeal/auctions/controller/auctions.php má umožnit přístup proměnným $config, $db, $request a dalším. Samozřejmě nemusí být nutné všechny, ale tyto se téměř vždy hodí.


Kód: Vybrat vše

    path: /auctions
    defaults: { _controller: webdeal.auctions.controller:handle}
V rychlosti: tento soubor phpBB říká, že pokud uživatel zadá adresu www.vaseforum.cz/auctions; pak má vykreslit vše co je v controlleru ve funkci handle(). Pokud používáte jiný název rozšíření, nezapomeňte příslušně změnit názvy.

Nyní vytvoříme ve složce controller soubor auctions.php a vložíme do něj následující obsah:

Kód: Vybrat vše

* @package phpBB Extension - WebDeal s.r.o.
* @copyright (c) 2016-2018 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2

namespace webdeal\auctions\controller;

class auctions
	/* @var \phpbb\config\config */
	protected $config;
	/* @var \phpbb\controller\helper */
	protected $helper;
	/* @var \phpbb\template\template */
	protected $template;
	/* @var \phpbb\user */
	protected $user;
	protected $request;
	protected $root_path;

	* Constructor
	* @param \phpbb\config\config		$config
	* @param \phpbb\controller\helper	$helper
	* @param \phpbb\template\template	$template
	* @param \phpbb\user				$user

	public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, $root_path)
		global $table_prefix;

		$this->config = $config;
		$this->db = $db;
		$this->helper = $helper;
		$this->request = $request;
		$this->template = $template;
		$this->user = $user;
		$this->root_path = $root_path;

	public function handle() {
		return $this->helper->render('auctions_body.html', 'Seznam aukcí');
Pokud jste postupovali správně, pak po zadání adresy www.vaseforum.cz/auctions uvidíte obsah, který jste si vložili do ext/webdeal/auctions/styles/all/template/auctions.html (nezapomeňte promazat cache).

Nyní už s pomocí tohoto a 2 předchozích dílů umíte vytvořit vlastní stránku. Přidat další stránku už bude hračka, ale o tom až příště.

Na závěr přidávám zdrojové kódy ve stavu v jakém jsou na konci tohoto dílu.
(4.23 KiB) Staženo 14 x
Starám se o projekt phpBB.cz od doby, kdy jsem jej zachránil před zaniknutím. Pomůžete mi a dostaneme jej zase nahoru?
Přes soukromé zprávy ani Facebook neposkytuji podporu.

Příspěvky: 1
Registrován: čtv 17. kvě 2018 9:06:26

cheap nfl jerseys cheap baskball jerseys 0-24-0-24-1103381

Příspěvek od gHzcXItj3a » pon 28. kvě 2018 8:32:12

This is my attempt to do so. And I can't Lego Oh. The stress made on your body as you step can also be causing pain in your ankles, knees, legs, and lower back.. As far as the tanking goes, idgaf how many stars it may produce for you, it isn't the way, especially over the course of years.

I suggest he pays off the loan now because it is also a risk. The VAST MAJORITY of murders happen with one or two victims at a time. I suppose they wholesale nfl jerseys preferred getting into their offense quicker and more effectively than they could if you had blockers up.

I know Jax doesn't thrive as well in Matt Stajan Jersey
teamfights compared to splitting, but if you can't split then you have no choice but to consider the alternative. Because they refuse to cheap nfl jerseys believe the science and history.You want to play actual devil's advocate? Bring me actual research that backs up your points. cheap china jerseys

My Total Wine used to keep it on the shelf, and I never had an issue finding and buying it. If you tend to miss to the right already consider the Eric Reid Jersey
midsize, if you miss to the left carry on with the oversize/jumbo.. Don't indulge negative thoughts.". Today I will write about the juicy fights and life long enemies that we read about in the tabloids.

One is a eunuch that has been that way from birth. By the time the smoke cleared, the ranks of Great Powers had been reduced to two and in every way that counted, the United States enjoyed vast advantages over its only conceivable rival, the Soviet Union..

Please, literally anyone, explain to me where cheap jerseys china all this "We only get edgy skins" logic comes from. With the knowledge she learned from him, she made her own tools and created an iron gate for the entrance to their home. I wonder if there is a https://www.nhlmapleleafsonline.com/dou ... -c_10.html
link between our Russian descent because when my Mother was alive she told me that many many years ago because Russia borders Mongolia there were many Mongolian/Russian marriages and susequent children so we probably Noah Juulsen Jersey
have Asian blood in our lineage.

It not quite there yet. We know that Abigail hair wasn always purple, and the comment that it hasn faded still implies that Tyler Flowers Jersey
it was at one point dyed to that color. F=ma=delta p/ delta t. You'll eventually find someone that you're attracted to in a physical and personality way; and hopefully it's a reciprocal feeling.

Most owners are actually very kind, chill people. The high damage is pretty tough to compete with, but it nearly a capstone, and I would need to see it in action or math out before I said it needed a nerf.. Not only did women invent agriculture and farming, which led to civilization, but they invented textiles as well.

Before the beard, many people saw me as too "pretty" and often would react negatively to me before I could even open my mouth and say hello. They don make any assumptions about my abilities that they wouldn make about a man they don know. In contrast, carbon taxes may actually boost GDP, if the revenue is used to offset other (distortional) taxes or even just returned as an equitable dividend (the poor tend to spend money when they got it, which boosts economic growth)..

High profile appeals that may reach the court in the next couple of years include Arizona's sweeping immigration reform law; California's ban on same sex marriage; and a challenge to health care mandates passed by Congress this spring.Here are the two oaths Elena Kagan took Saturday:Constitutional oath: "I do solemnly swear (or affirm) that I cheap jerseys supply will support and defend the Constitution of the United States against all enemies, foreign and domestic; that I cheap jerseys wholesale will bear true faith and allegiance to the same; that I take this obligation freely, without any mental reservation or purpose of evasion; and that I will well and faithfully discharge the duties of the office on which I am about to enter: So help me God."Judicial oath: "I do solemnly swear (or affirm), that I will administer justice without respect to persons, and do equal right to the poor and to the rich, and that I will faithfully and impartially discharge and perform all the duties incumbent on me, under the Constitution and laws of the United States.

A good and cheap jerseys:
cheap china jerseys
wholesale jerseys