Advertisement:

Author Topic: ajax load items in theme  (Read 1204 times)

dumopuh

  • Newbie
  • *
  • Posts: 1
ajax load items in theme
« on: December 07, 2014, 09:09:35 pm »
Hi to all =) Sorry for my english. OSClass v.3.5.1, theme bender or copy.

I try ajax load items to main page. But i don't understand how to use osc_add_route() for ajax.

I create file /oc-content/themes/bender/myroute.php

inside this file I get items, and it works if place code to main page. (I don't use direct requests to the database, I use osclass functions and functions from theme)

And write route
osc_add_route('myroute', 'myroute/([0-9]+)', 'myroute/{sCategory}', 'myroute.php');
but link mydomain/myroute/xx don't work (The requested URL ... was not found on this server.)
ok, nevermind =) But osc_route_url('myroute', array('sCategory' => xx)) don't work too =( Why?

in routes my route exist
Array ( [myroute] => Array ( [regexp] => myroute/([0-9]+) [url] => myroute/{sCategory} [file] => myroute.php [user_menu] => [location] => custom [section] => custom [title] => Custom ) )

When I go to this url I see 404 page, because in  /oc-include/osclass/controller/custom.php :
line 53:
// check if the file exists
            if( !file_exists(osc_plugins_path() . $file) && !file_exists(osc_themes_path() . $file) ) {
                $this->do404();
                return;
            }

no problem, I change my route to osc_add_route('myroute', 'myroute/([0-9]+)', 'myroute/{sCategory}', 'bender/myroute.php');
and fix it, but below in file  /oc-include/osclass/controller/custom.php , in line 78 :

osc_current_web_theme_path($file);

which means that my file not found again =(

I suspect that I misunderstand =)
Please tell me the right way. And sorry for my english again, because I imagine how hard it is to you to understand me.








SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: ajax load items in theme
« Reply #1 on: January 14, 2015, 01:30:13 am »