Jump to content

Gideon So

Members
  • Posts

    469
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Gideon So

  1. Hi @Jim Bailie

    I think you can use the Page Reference field. And then loop the page reference field to show the content of the selected page.

    For example, I add a Page Reference field named other-page-content.

    I can add the following code to my main template

    <?php 
    	foreach($page->other-page-content as $other-page) {
    		echo "<div>";
    		echo $other-page->your-content-field;
    		echo "</iv>";
    }

    Hope this help.

    Gideon

    • Thanks 1
  2. Hi @johnners

    1. Create a new template whatever name you think fit, such as update-home-body.

    2. Create a page and assign the template created above to it.

    3. Create a new template php file named the same name as the template created in step 1 such as update-home-body.php in the site/template folder.

    4. Put the following code in the template file.

    <?php

    $home = $pages->get(1);

    $home->of(false);

    $content = "whatever you want or read it from somewhere";

    $home->body = $content;

    $home->save();

    5. Create a cron job to access the page at the designated time.

    Hope this helps.

    Gideon

    ?>

    • Like 1
  3. Hi @joe_g

    $pages->addHookAfter('added', function(HookEvent $event) {
    	$pages = $event->object;
    	// The page that is being added
    	$page = $event->arguments(0);
    	// If the page passes some kind of test
    	if($page->template == 'your-template-name') {
    		// Set the sort value for the new page to zero (sibling sort will be automatically adjusted)
    		$pages->sort($page, 0);
    	}
    });

    Put this piece of code into the ready.php.

    Hope this help.

    Gideon

  4. Hi @jploch

    I have the following JS error in the console.
     

    Failed to load resource: the server responded with a status of 404 (Not Found) fieldsettings.css
    
    Uncaught Error: [HMR] Hot Module Replacement is disabled.
        at Object.<anonymous> (main.js:1:273800)
        at Object.<anonymous> (main.js:1:273857)
        at i (main.js:1:110)
        at Object.<anonymous> (main.js:1:220711)
        at Object.<anonymous> (main.js:1:220891)
        at i (main.js:1:110)
        at Object.<anonymous> (main.js:1:273910)
        at i (main.js:1:110)
        at main.js:1:902
        at main.js:1:912

    And I see a lot of this error:

    Failed to load resource: the server responded with a status of 500 (Internal Server Error) __webpack_hmr

    Any reason why I saw all this error?

    Gideon

    P.S. I am using version 0,4 and install in a sub-folder.

     

     

     

×
×
  • Create New...