Zadejte hledaný výraz...
Jakub Glos
Webtrh.cz
Vývoj webových stránek na WordPressu a proklientský přístup pro freelancery
Třídenní infromacemi nabitý prezenční + online kurz v Praze od Webtrhu pouze za 2 871 Kč
Více informací

Lavarel – počet příspěvků na stránce

Tomina10
verified
rating uzivatele
(10 hodnocení)
30. 12. 2020 00:08:59
Ahoj,
potřeboval bych poradit, mám pluigin který nemá nastavitelný počet zobrazovaných příspěvků na stránce. A já bych právě toto chtěl změnit, a nastavit jen 3. Pomůže mi s tím prosím někdo?
Zde je dokumentace, ale nějak nevím co a jak..
Zde soubor Pluigin.php
use SystemClassesPluginBase;
class Plugin extends PluginBase
{
public function registerComponents()
{
return ;
}
public function registerSettings()
{
}
}
controllers/testimonials.php
use BackendClassesController;
use BackendMenu;
class Testimonials extends Controller
{
public $implement = ;
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $reorderConfig = 'config_reorder.yaml';
public $requiredPermissions = ;
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Dizoo.Testimonials', 'main-menu-item');
}
}
components/testimonials.php
namespace DizooTestimonialscomponents;
use CmsClassesComponentBase;
use DizooTestimonialsModelsTestimonials as Quotes;
class Testimonials extends ComponentBase {
public function componentDetails()
{
return ;
}
public function onRun()
{
$testimonials = $this->getTestimonials();
if($testimonials->isNotEmpty()) {
$this->page = $testimonials;
} else {
$this->page = false;
}
}
public function getTestimonials()
{
return Quotes::inRandomOrder()->get();
}
public function defineProperties()
{
return {6}|{3})$',
'validationMessage' => 'Please fill in a valid hex code with the #'
],
'textColor' => {6}|{3})$',
'validationMessage' => 'Please fill in a valid hex code with the #'
],
'postsPerPage' => +$',
'validationMessage' => 'rainlab.blog::lang.settings.posts_per_page_validation',
'default' => '10',
]
];
}
}
30. 12. 2020 00:08:59
https://webtrh.cz/diskuse/lavarel-pocet-prispevku-na-strance/#reply1473107
chladek
verified
rating uzivatele
(4 hodnocení)
30. 12. 2020 00:32:42
do getTestimonials přidej limit(3)
return Quotes::inRandomOrder()->limit(3)->get();
30. 12. 2020 00:32:42
https://webtrh.cz/diskuse/lavarel-pocet-prispevku-na-strance/#reply1473106
Pro odpověď se přihlašte.
Přihlásit