Two pages (static x blog) ability to make the search result show blog page from static homepage (bludit-4.0.0-rc-3)

Post Reply
oloh
Jr. Bludit
Posts: 3
Joined: Wed May 25, 2022 6:48 pm
Has thanked: 2 times

Greetings all,

I developed a new theme similar to Popeye theme(bludit-4.0.0-rc-3).

Now, I have a static homepage (mainpage.php) and a blog page (home.php).

I also have a search function plugin in both page. I want the search result to return the home.php structure/design instead of mainpage.php structure/design when initiated from the homepage (mainpage.php).

Finally, for context, I replaced the following

Code: Select all

<?php
		// $WHERE_AM_I variable provides where the user is browsing
		// If the user is watching a particular page the variable takes the value "page"
		// If the user is watching the frontpage the variable takes the value "home"
		// If the user is watching a particular category the variable takes the value "category"
		if ($WHERE_AM_I == 'page') {
			// Check if the page has a template
			$template = $page->template();
			if (($template) && file_exists(THEME_DIR_TEMPLATES.$template)) {
				include(THEME_DIR_TEMPLATES.$template);
			} else {
				include(THEME_DIR_PHP.'page.php');
			}
		} else {
			include(THEME_DIR_PHP.'home.php');
		}
	?>
with this:

Code: Select all

<?php if ($WHERE_AM_I == 'page') {
		// Check if the page has a template
   		if ($page->slug() == "home") {
       include(THEME_DIR_PHP.'home.php');
   }
      else {
       include(THEME_DIR_PHP.'page.php');
   }
}
else {
   include(THEME_DIR_PHP.'mainpage.php');
} ?>
Please check if this is correct.


P.S. I want the search function to accurately retrieve content. I'd appreciate guide toward that as well.

Thank you
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

This is not part of the core functions of Bludit. If you cannot modify it by yourself you have to look for a freelancer.

And please be aware: Bludit v4 is still only for testing puposes.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply