Advertisement:

Author Topic: [Tutorial]: show static page on homepage without modify .htaccess  (Read 988 times)

Roberto

  • Newbie
  • *
  • Posts: 46
[Tutorial]: show static page on homepage without modify .htaccess
« on: September 14, 2013, 04:41:25 pm »
Hello,
i'm using this little trick on my theme (based on modern theme) and i want to share it:

1) Create a php file and call it page-my_page.php (this is your static page);
2) Create a copy of main.php and rename it whatever you want (example, 'latest-listing.php');
3) Open main.php and replace code with :
Code: [Select]

<?php
$filename 
'oc-content/themes/my-theme-name/my_page.php';

if (
file_exists($filename)) {
 osc_current_web_theme_path('my_page.php') ;
} else {
   
 osc_current_web_theme_path('latest-listing.php') ;
}
?>


Hope will be useful!

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: [Tutorial]: show static page on homepage without modify .htaccess
« Reply #1 on: September 15, 2013, 04:42:40 am »
Beside Admin dashboard, what are the benefits of this method? And what .htaccess has to do with new page? (serously asking)

thanks

Roberto

  • Newbie
  • *
  • Posts: 46
Re: [Tutorial]: show static page on homepage without modify .htaccess
« Reply #2 on: September 15, 2013, 11:07:22 am »
I was reading that a method to indicate the home page is to modify htaccess like this:
Code: [Select]
DirectoryIndex index.php index.html site-down.phpMy method has no practical advantage, is only one alternative for those who wish to use.

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: [Tutorial]: show static page on homepage without modify .htaccess
« Reply #3 on: September 15, 2013, 12:04:03 pm »
Ok, I didn't realise immediately what you try to do.

thanks