Advertisement:

Author Topic: (NEW) Static Home Page Plugin  (Read 9481 times)

siteturbo

  • Newbie
  • *
  • Posts: 16
(NEW) Static Home Page Plugin
« on: April 30, 2011, 04:07:43 am »
I've just created a plugin called statichomepage which allows you to create a static home page for your OSClass system.

Attached is the plugin.  Let me know how it works for you. :)


_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: (NEW) Static Home Page Plugin
« Reply #1 on: May 02, 2011, 12:19:06 pm »
Hi siteturbo,

Your plugin is great and it work very well, but I don't feel confortable modifying core files of OSClass (as your osclass_root_folder/index.php file).
You could obtain the same result following these steps :

1.- Copy oc-content/themes/your_theme_folder/main.php to oc-content/themes/your_theme_folder/dynamic_homepage.php (Usually your_theme_folder is "modern", the default theme)
2.- Modify oc-content/themes/your_theme_folder/main.php with your favorite editor to leave it as a static homepage.
3.- Create a "Page" on the OSClass' admin area, put as a internal name "dynamic_homepage", put any title and any description, don't worry, they will not be shown.
4.- Done!!!

Note: To link to the dynamic homepage you have to use this :
Code: [Select]
<?php osc_get_static_page('dynamic_homepage');
osc_static_page_url(); ?>

With that method, you don't modify any core file (which in case of update will be overwritten!) and you have full control over the content of both your homepages (you could make them both dynamics!

Anyway, I was amazed at your plugin, make a plugin it's kind of tricky (there's not a lot of documentation yet).

Thanks!!!

siteturbo

  • Newbie
  • *
  • Posts: 16
Re: (NEW) Static Home Page Plugin
« Reply #2 on: May 03, 2011, 01:07:05 am »
_CONEJO,

Yes, that is another way.

However, I believe the same problem occurs when you change themes, the plugin won't work except for the theme that you modify.  I could be wrong, but I think that would occur.

I really wanted to create the plugin with a hook, however, it does not appear that the OSclass software is mature enough yet to allow hook calls where I need them for this plugin. Therefore, I had to hard code it in the script by brute force!  ;D

Thanks for the comments.


_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: (NEW) Static Home Page Plugin
« Reply #3 on: May 03, 2011, 02:06:47 am »
Hi siteturbo,

The current "attributes" plugin are almost "theme-free", of course, at some point in the theme you should place a hook to put the new field information at a specific place. It can not be done with less code, just one line.

Anyway, I'm very happy that someone who is not me made a plugin ;) Thanks!

chin

  • Newbie
  • *
  • Posts: 3
Re: (NEW) Static Home Page Plugin
« Reply #4 on: May 04, 2011, 01:14:10 pm »
Hi,

Where i need to add the below code.

<?php osc_get_static_page('dynamic_homepage');
osc_static_page_url(); ?>


Hi siteturbo,

Your plugin is great and it work very well, but I don't feel confortable modifying core files of OSClass (as your osclass_root_folder/index.php file).
You could obtain the same result following these steps :

1.- Copy oc-content/themes/your_theme_folder/main.php to oc-content/themes/your_theme_folder/dynamic_homepage.php (Usually your_theme_folder is "modern", the default theme)
2.- Modify oc-content/themes/your_theme_folder/main.php with your favorite editor to leave it as a static homepage.
3.- Create a "Page" on the OSClass' admin area, put as a internal name "dynamic_homepage", put any title and any description, don't worry, they will not be shown.
4.- Done!!!

Note: To link to the dynamic homepage you have to use this :
Code: [Select]
<?php osc_get_static_page('dynamic_homepage');
osc_static_page_url(); ?>

With that method, you don't modify any core file (which in case of update will be overwritten!) and you have full control over the content of both your homepages (you could make them both dynamics!

Anyway, I was amazed at your plugin, make a plugin it's kind of tricky (there's not a lot of documentation yet).

Thanks!!!

AndreiD

  • Newbie
  • *
  • Posts: 19
Re: (NEW) Static Home Page Plugin
« Reply #5 on: August 06, 2011, 03:50:52 pm »
Can someone please create a step by step tutorial ?

I've tried to do what it say on the post's above but  the custom page is not showing on my homepage.

I've created a page dynamic_homepage in admin , I've created a dynamic_homepage.php (what kind of code/content should i add in this page?or should it be blank?)  and added to my theme folder. I've added <?php osc_get_static_page('dynamic_homepage');
osc_static_page_url(); ?> in my main.php, but nothing shows up .

Thank you!
« Last Edit: August 06, 2011, 03:55:25 pm by AndreiD »

dealbanker

  • Newbie
  • *
  • Posts: 3
Re: (NEW) Static Home Page Plugin
« Reply #6 on: September 26, 2011, 03:58:40 pm »
Hello Siteturbo

I have installed the plugin but no idea what to do next?

shane

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: (NEW) Static Home Page Plugin
« Reply #7 on: September 26, 2011, 04:10:10 pm »
Hi dealbanker,

Please, don't use this plugin, use the procedure I explained on the second comment of this topic.

Thanks

marxxx

  • Full Member
  • ***
  • Posts: 142
Re: (NEW) Static Home Page Plugin
« Reply #8 on: March 18, 2012, 09:50:12 pm »
Hi,

Where i need to add the below code.

<?php osc_get_static_page('dynamic_homepage');
osc_static_page_url(); ?>


Hi siteturbo,

Your plugin is great and it work very well, but I don't feel confortable modifying core files of OSClass (as your osclass_root_folder/index.php file).
You could obtain the same result following these steps :

1.- Copy oc-content/themes/your_theme_folder/main.php to oc-content/themes/your_theme_folder/dynamic_homepage.php (Usually your_theme_folder is "modern", the default theme)
2.- Modify oc-content/themes/your_theme_folder/main.php with your favorite editor to leave it as a static homepage.
3.- Create a "Page" on the OSClass' admin area, put as a internal name "dynamic_homepage", put any title and any description, don't worry, they will not be shown.
4.- Done!!!

Note: To link to the dynamic homepage you have to use this :
Code: [Select]
<?php osc_get_static_page('dynamic_homepage');
osc_static_page_url(); ?>

With that method, you don't modify any core file (which in case of update will be overwritten!) and you have full control over the content of both your homepages (you could make them both dynamics!

Anyway, I was amazed at your plugin, make a plugin it's kind of tricky (there's not a lot of documentation yet).

Thanks!!!

kingofpain

  • Jr. Member
  • **
  • Posts: 95
Re: (NEW) Static Home Page Plugin
« Reply #9 on: June 26, 2012, 04:24:27 pm »
Hi siteturbo,

Your plugin is great and it work very well, but I don't feel confortable modifying core files of OSClass (as your osclass_root_folder/index.php file).
You could obtain the same result following these steps :

1.- Copy oc-content/themes/your_theme_folder/main.php to oc-content/themes/your_theme_folder/dynamic_homepage.php (Usually your_theme_folder is "modern", the default theme)
2.- Modify oc-content/themes/your_theme_folder/main.php with your favorite editor to leave it as a static homepage.
3.- Create a "Page" on the OSClass' admin area, put as a internal name "dynamic_homepage", put any title and any description, don't worry, they will not be shown.
4.- Done!!!

Note: To link to the dynamic homepage you have to use this :
Code: [Select]
<?php osc_get_static_page('dynamic_homepage');
osc_static_page_url(); ?>

With that method, you don't modify any core file (which in case of update will be overwritten!) and you have full control over the content of both your homepages (you could make them both dynamics!

Anyway, I was amazed at your plugin, make a plugin it's kind of tricky (there's not a lot of documentation yet).

Thanks!!!


can somebody please simplify these instructions - mainly steps 1 and 2?

i.e. do you copy the contents of main.php into a new file dynamic_homepage.php?
and what do you mean by leave main.php as the static page?
also where do you put the php code?
« Last Edit: June 26, 2012, 04:29:11 pm by kingofpain »

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: (NEW) Static Home Page Plugin
« Reply #10 on: June 26, 2012, 06:29:10 pm »
Hi kingofpain,

for step 1 you have to copy the main.php and paste a copy then rename the copy to page-dynamic_homepage.php you can name it what ever you want just you have to keep the page- part in the beginning. For step 2 you would edit the main.php file and remove almost all of the php code making the static You will just want to remove the php code from between the <div class="container"> </div>. Then for step 3 you create a page in osclass and set the internal name the same as the file name minus the page- part. The php code goes in the main.php file so you can link to your dynamic page.

The php code in a link form would be like this.

<?php osc_get_static_page('dynamic_homepage'); ?>
<a href="<?php echo osc_static_page_url(); ?>"><?php echo osc_static_page_title(); ?></a>


Jay

kingofpain

  • Jr. Member
  • **
  • Posts: 95
Re: (NEW) Static Home Page Plugin
« Reply #11 on: June 26, 2012, 10:42:24 pm »
hey jay thanks for that i think i understand now, how do i do a check to see if the user is logged in and if they are direct them straight to the dynamic homepage if not leave them on the static homepage with a login form if thats possible?

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: (NEW) Static Home Page Plugin
« Reply #12 on: June 27, 2012, 05:56:56 pm »
Hi kingofpain,

To check if the user is logged in you would do something like thsi.


<?php if(!osc_is_web_user_logged_in() ) {  ?>

all of your page content

<?php } else { ?>
<script>location.href="<?php echo osc_user_login_url(); ?>"</script>
<?php ?>


And that will take you to your dynamic homepage if you are logged in.

Jay

kingofpain

  • Jr. Member
  • **
  • Posts: 95
Re: (NEW) Static Home Page Plugin
« Reply #13 on: June 29, 2012, 03:44:10 pm »
Hi kingofpain,

To check if the user is logged in you would do something like thsi.


<?php if(!osc_is_web_user_logged_in() ) {  ?>

all of your page content

<?php } else { ?>
<script>location.href="<?php echo osc_user_login_url(); ?>"</script>
<?php ?>


And that will take you to your dynamic homepage if you are logged in.

Jay

that helper takes me to the user profile page im trying this instead but it just says page not found any advice?

 <?php } else { ?>
<?php osc_get_static_page('dynamic_homepage'); ?>
<script>location.href="<?php echo osc_static_page_url(); ?>"</script>
<?php } ?>

kingofpain

  • Jr. Member
  • **
  • Posts: 95
Re: (NEW) Static Home Page Plugin
« Reply #14 on: July 01, 2012, 12:09:13 am »
Hi kingofpain,

To check if the user is logged in you would do something like thsi.


<?php if(!osc_is_web_user_logged_in() ) {  ?>

all of your page content

<?php } else { ?>
<script>location.href="<?php echo osc_user_login_url(); ?>"</script>
<?php ?>


And that will take you to your dynamic homepage if you are logged in.

Jay

that helper takes me to the user profile page im trying this instead but it just says page not found any advice?

 <?php } else { ?>
<?php osc_get_static_page('dynamic_homepage'); ?>
<script>location.href="<?php echo osc_static_page_url(); ?>"</script>
<?php } ?>

actually it does take you to dynamic page but only after you have logged in the first stop after logging in is actually the user dashboard any idea why this is happening?