1. Osclass Forum
  2. General
  3. how can i create a custom page

how can i create a custom page

Started by Matthew Ade, July 7, 2021, 8:11 pm

  • 1

Matthew Ade

how can i create a custom page

on :July 7, 2021, 8:11 pm #471

i need  to create a custom page... i want to show some ads be on search keywords..like now i search for iphone 6 oon my website and it brings out some listing.. check this link: https://+++/search/pattern,iphone+5/select_1,0  now, my question is how can i use this listing that was fetch out on a custom page.. thanks i will be happy if someone can help me

  • << Last edit: July 7, 2021, 8:42 pm by calinbehtuk >>
  • Quote

calinbehtuk

Re: how can i create a custom page

on :July 7, 2021, 8:51 pm #472

If the pattern is you parameter



Code: [Select]
​function searchPageHook() {

    $pattern = Params::getParam('pattern');

    switch ($pattern) {
        case('someValue'):

            /*
            * load some other page not the serach page
            */
            exit();
            break;
    }
}

osc_add_hook('before_search', 'searchPageHook');



But this depends about what exactly do you want to achieve.
This option will not load any content so you need to include the header and footer, etc.

  • << Last edit: July 7, 2021, 10:29 pm by calinbehtuk >>
  • Quote

Matthew Ade

Re: how can i create a custom page

on :July 7, 2021, 11:20 pm #473

Quote from: calinbehtuk on July 7, 2021, 8:51 pm

If the pattern is you parameter



Code: [Select]
​function searchPageHook() {

    $pattern = Params::getParam('pattern');

    switch ($pattern) {
        case('someValue'):

            /*
            * load some other page not the serach page
            */
            exit();
            break;
    }
}

osc_add_hook('before_search', 'searchPageHook');



But this depends about what exactly do you want to achieve.
This option will not load any content so you need to include the header and footer, etc.


thanks for your reply...pls take a look at this code i added header and and footer.. but it shows page not find and this is my link: https://++/custom.php


<?php osc_current_web_theme_path('head.php') ; ?>
    <body>
    <?php osc_current_web_theme_path('header.php') ; ?>
           
            <div class="col-md-12"><?php osc_render_file(); ?></div>
function searchPageHook() {

    $pattern = Params::getParam('pattern');

    switch ($pattern) {
        case('toyota'):

            /*
            * load some other page not the serach page
            */
            exit();
            break;
    }
}

osc_add_hook('before_search', 'searchPageHook');

        <?php osc_current_web_theme_path('footer.php') ; ?>
    </body>

  • << Last edit: July 7, 2021, 11:32 pm by calinbehtuk >>
  • Quote

Matthew Ade

Re: how can i create a custom page

on :July 7, 2021, 11:23 pm #474

thanks for your reply... i have header and footer but it shows page not find... and this is my link: https://++/custom.php and the code:


<?php osc_current_web_theme_path('head.php') ; ?>
    <body>
    <?php osc_current_web_theme_path('header.php') ; ?>
           
            <div class="col-md-12"><?php osc_render_file(); ?></div>
function searchPageHook() {

    $pattern = Params::getParam('pattern');

    switch ($pattern) {
        case('toyota'):

            /*
            * load some other page not the serach page
            */
            exit();
            break;
    }
}

osc_add_hook('before_search', 'searchPageHook');

        <?php osc_current_web_theme_path('footer.php') ; ?>
    </body>

  • << Last edit: July 7, 2021, 11:32 pm by calinbehtuk >>
  • Quote

calinbehtuk

Re: how can i create a custom page

on :July 7, 2021, 11:40 pm #476

You must have a minimum knowledge of how osclass works.

The code that i provide you need to be included in function.php from your theme or a plugin.


That code already breaks the page from being loaded, so you need to load the page from your theme.


In functions.php from your theme

Code: [Select]
​function searchPageHook() {

    $pattern = Params::getParam('pattern');

    switch ($pattern) {
        case('toyota'):
osc_current_web_theme_path('yourCustom.php');
            exit();
            break;
    }
}

osc_add_hook('before_search', 'searchPageHook');


In your theme folder you need to have that file yourCutom.php and in that file you include the content. But again, you will not succeed if you don't have minimal knowledge.



Matthew Ade

Re: how can i create a custom page

on :July 12, 2021, 1:07 am #478

can you create plugin for me to solve this issue?

Matthew Ade

Re: how can i create a custom page

on :July 12, 2021, 1:12 am #479

or is there a way to rewrite this url: https://+++.ng/search/pattern,toyota+corolla/select_1,0 and add meta title and description to it?

  • << Last edit: July 12, 2021, 6:57 am by calinbehtuk >>
  • Quote
  • 1
Subscribe
X

Subscribe!

Subscribe to get the latest listings, updates and special offers delivered directly in your inbox.