Is it possible to configure/improve the AJAX search in MediaWiki? - php

Our company has an internal MediaWiki installation with a page called "Our Spamfilter". When typing into the search bar, suggestions show up below it in real time (see the $wgEnableOpenSearchSuggest setting.)
Unfortunately, when typing out spamfilt..., the AJAX search box fails to suggest the article. It only suggests it if you type out our spa..... Basically, what you type has to match the title of the article exactly from left to right.
This is already causing confusion as people assume the page doesn't exist if they type "spamfilter" and get no suggestions.
Is there a reasonably simple way (a setting or plugin) to improve the AJAX search box? When I say "improve", I mean that typing "spam" at least has to suggest the "Our Spamfilter" page.

You could probably use the SpecialSearchResults hook or mess with the JS code, but it is much simpler to just make a redirect from Spamfilter to Our Spamfilter.

Related

PHP Crawling and Parsing (aspx)

I'm working on a project I have for my studies. I'm trying to combine economics and programming together by crawling through some public sites, and using that data to generate some sorts of economic reports.
I have managed to do all the sites I need, besides one. The site is written in C# (.aspx extension). And as far as my knowledge of HTTP requests it uses a POST request. All other sites I crawled were using GET requests (so that wasn't so hard).
The next part might be a bit confusing, but I would really appriciate if someone took a bit of their time and helped me :)
The site is on the following address:
http://www.apr.gov.rs/eng/Registers/FinancialLeasing.aspx
Select the option on the right 2. Search by leasing Acceptor
The address of the page option 2 leads to is: http://reliz.apr.gov.rs/Reliz/Search/GeneralLeasingAgreementLeaseeSearch.aspx but if I use it directly it gives me EXPIRED SESSION error (so I guess that is one of the problems also)
This page now is on my native language (Serbian) so please bear with me just a bit longer.
Here:
U need to select Привредни субјект * (second from 2 radio buttons)
And below that Матични број/Рег. бр., земља (first check button)
And then to enter for example 08010536 in the input field that appears after checking the button.
And then press Enter or the button Пронађи that's on the far right.
After that a table appears at the bottom of the page. I need to get (crawl) data from that table, but I don't know how to make it appear with crawling :/
So far for crawling I have been using cUrl for php.
This is my final project at University, and i would appriciate any help or hint that i get.

Getting a discussion forum /query support on my website

I want to have a forum like thing on my website.I dont want any complicated thing, just the user must be able to post questions and the administrator(that is me) can answer them..(It would be nice if it has tree like structure but even without that it is fine) ..All the users can read the questions on the forum anytime(obvious) ..I dont want to put phpbb3 or any such readymade tool..I just want to be it simple (something like this scroll to the bottom) ..How to get this thing done..If possible in php please tell that..Otherwise tell other options..Please help me out..
You could probably do something like this in WordPress. (Your local webserver would need to be running MySQL as well as PHP to achieve this.) At the simplest level you could set up a page and allow user comments on it.
A really simple way is just to have a basic form with text-input, textarea, and submit button. Then have the person input their name, question, and submit it. Make sure you validate the form with js and/or php. Then update a password protected page that only you can access with the name and question. Then using whatever cms you have for this page (or just static html if you have the patience) you can just update the front page with the new question and answer above the form.
The best way, though, is going to be some kind of "readymade" system that you tweak...

Whats up with this google url?

So I know a little bit of PHP, and while I was making custom search links I realized that today google's url after searching something like "hi" isnt just
http://www.google.com/search?q=hi
instead its this
http://www.google.com/#sclient=psy&hl=en&site=&source=hp&q=hi&pbx=1&oq=hi&aq=f&aqi=g5&aql=&gs_sm=e&gs_upl=1705l1911l0l2131l2l2l0l0l0l0l173l299l0.2l2l0&bav=on.2,or.r_gc.r_pw.r_cp.&fp=6c03fc000f912511&biw=1366&bih=681
Just wondering if someone has some insight as to what kind of info the rest of the url is passing along
Some examples of the data passed along:
hl=en #Locale: english
source=hp #Source: homepage
q=hi #Query: hi
In general, it's just whatever extra data that Google wishes to capture or pass along. As you've probably noticed, it's not required data in the sense that http://www.google.com/search?q=query works fine.
The 2nd one is likely an addressing string. This is often used for navigating without full page loads. This way a user can press the back button without going back to a previous url.
If you notice, outside of all the parameters passed, the real difference is:
www.google.com/#
vs:
www.google.com/search?all_the_name=values&
The first example there is no page defined, the pound symbol tells it to stay where it is. Google has a feature that loads the results as you type (not the auto suggest) but the entire page. I can't seem to find how to trigger this though.

How to make a basic Forum Thread on my website?

How to make a basic Forum Thread on my website ?
Like they click it shows the thread without going to a new page and what not.
EDIT*** Like the user he clicks something that says Thread or a Programming* and it shows all the posts and they may view that post as if it were on a whole new page without the Programming and thread just the post.
You wont be able to do this PHP only...
You can do this with JavaScript though I prefer JQuery as it makes dealing with JavaScript easier. This is a great tutorial on getting started with JQuery which covers show/hide effects (which is what you want to look at to achieve the functionality you've described.)
http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery
Good Luck!

problem with ajax( page refresh)

hi im using ajax to extract all the pages into the main page but am not being able to control the refresh , if somebody refreshes the page returns back to the main page can anybody give me any solutions , i would really appreciate the help...
you could add anchor (#something) to your URL and change it to something you can decode to some particular page state on every ajax event.
then in body.onload check the anchor and decode it to some state.
back button (at least in firefox) will be working alright too. if you want back button to work in ie6, you should add some iframe magic.
check various javascript libraries designed to support back button or history in ajax environment - this is probably what you really need. for example, jQuery history plugin
You can rewrite the current url so it gives pointers to where the user was - see Facebook for examples of this.
I always store the 'current' state in PHP session.
So, user can refresh at any time and page will still be the same.
if somebody refreshes the page returns back to the main page can anybody give me any solutions
This is a feature, not a bug in the browser. You need to change the URL for different pages. Nothing is worse then websites that use any kind of magic either on the client side or the server side which causes a bunch of completely different pages to use the same URL. Why? How the heck am I gonna link to a specific page? What if I like something and want to copy & paste the URL into an IM window?
In other words, consider the use cases. What constitutes a "page"? For example, if you have a website for stock quotes--should each stock have a unique URL? Yes. Should you have a unique URL for every variation you can make to the graph (i.e. logarithmic vs linear, etc)? Depends--if you dont, at least provide a "share this" like google maps does so you can have some kind of URL that you can share.
That all said, I agree with the suggestion to mess with the #anchor and parse it out. Probably the most elegant solution.

Categories