Note: As long as you will do this problem, your ability has been able to enter Baidu! If other departments do not want you, please send me e-mail, I will do my best to strongly recommend you! If you do not want to join Baidu, and other companies do not want you, can only show that the company blind.
Picture
Title: See picture, which is an area of a Web page that is used to display the classification of goods or other information. Each item in the category can be collapsed and folded (expanded and shrunk if there are subcategories). The series of classification is not fixed. A PHP variable exists:
$cats = Array ( ' id ' = = 1, ' name ' = ' academic and education ', ' children ' = = Array ( ' id ' = > 2, ' name ' = ' natural science ', ' children ' = null, ), //...), ),/ /...);
Write a PHP code that generates a section of the Html/javascript code that implements the functionality shown in this array, regardless of CSS style.
??? -
Note: This topic examines a very wide range, including PHP, HTML, JavaScript, CSS, recursion, only really mastered as many of the above skills, to achieve full functionality, otherwise you must rely on division of labor. The more a candidate can achieve, the higher the score.
If the candidate's position does not include HTML/JS/CSS, then the title can be changed to: Save the above PHP data in the form of indented text to the file, and read the file to generate an identical PHP array. (serialization and deserialization of custom formats)
Read this blog reader, if it has been done, and individuals want to join Baidu, please reply to the URL in the comments and explain your wishes, I will contact you. Or you can pack the program and send it to me.
Original: http://www.ideawu.net/blog/archives/585.html
Reply to discussion (solution)
Even if they do, they don't go in that hellhole.
Learning and Learning
Array->xml->xmltree, but Xmtree is written by others, hey
Array->xml->xmltree, but Xmtree is written by others, hey
Haha, of course you need to write it yourself.
Such a simple thing!
I suddenly found today is a special day. Already on Google's when, do not want to fall Baidu's pit.
Will do, but it takes a long time. Long to be unable to solve the interview.
Upstairs is too exaggerated, of course, the interview can be solved (estimated less half an hour, more than an hour will be over)
I said that such a simple thing can not be the requirements of Baidu ...
VB VB Drama Hair
Will do, but it takes a long time. Long to be unable to solve the interview.
In the lifetime of Baidu door open to you
I made a, very ugly. And only in the normal implementation of Firefox, ie under the bad.
To see the effect:
http://life161.web-48.com/t.php
Code:
1, ' name ' = ' academic and education ', ' children ' = = Array (' id ' = = 9, ' Name ' = ' natural science ', ' children ' = null, ' array (' id ' = 8 , ' name ' = ' Social science ', ' children ' = null, ', ' Array ( ' id ' = +, ' name ' = ' philosophy ', ' children ' + null, '//... ), array (' id ' = = 3, ' name ' = ' Technology and Inventions ', ' children ' = = Array ( ' id ' = 4, ' name ' = ' aerospace technology ', ' children ' + NULL, Array (' id ' = = 5, ' name ' = ' rocket technology ', ' chileren ' = null, ), array (' id ' = = 6, ' name ' = ' satellite technology ', ' children ' = > null,), // ... ), ), // ...); echo "\ n";//echo Json_encode ($cats);? >
Ul.js:
$ (document). Ready (function () {$ ("Li + ul"). Hide (); $ ("Li"). Click (function () {//alert (). Text ()), $ (this). Find (" +ul.list "). Toggle ();});
I look very depressed, please expert guidance.
This effect with PHP is not a bit far from hydrolysis near thirst, this effect is the front of the ext or jquery-ui node number tree Bar, why must use PHP to achieve this effect, Isn't it better to do JavaScript? And the configuration is also flexible, data. JSON data organization such as:
[{
"id": 1,
"code": "" ","
"name": "Name1",
"addr": "Address1",
"Col4": "Col4 Data",
"Iconcls": "Icon-ok",
"Children": [{
"id": 2,
"code": "0101",
"name": "Name11",
"addr": "Address1 1 ",
" checked ": True
},{
" id ": 3,
" code ":" 0102 ",
" name ":" Name12 ",
" addr ":" Address12 ",
" STA TE ":" Closed "
}]
},{
" code ":" Address2 ",
" name ":" Languages abc ",
" addr ":" Col4 ",
" Col4 " A ",
" state ":" Closed ",
" Children ": [{
" code ":" 0201 ",
" name ":" Java ",
" Col4 ":" Col4 Data ","
"state ":" Closed ",
" Children ": [{
" code ":" 02013 ",
" name ":" Jdk1 "
},{
" code ":" 02014 ",
" name ":" JDK2 "}]
},{
"code": "0202",
"name": "C #",
"Col4": "Col4 Data"
}]
}]
This structure I think the overall application should be more practical than PHP. !
Personal views: I do not understand why the landlord of this application called the history of the most powerful PHP application, but also useful JS I think whether it is the performance or ease of use is stronger than PHP, after all, the processing part is to the client to show the analysis effect, the latter only provide some data, in JSON form to return to the front-end part, There is no need for PHP to deal with so many things, in fact I think this requirement and tree is almost the same, the difference is only the platform of the data organization is different. Change the soup, the principle has long been applied in the production practice, the landlord said with JS will apply Baidu engine, then I really do not understand! Can pure PHP implement a node tree?
Must be in Baidu?
Not the application of recursion, ....
The JSON data in the code is obtained from the PHP server side. The HTML,JS,CSS code is as follows and does not use any JS frame. Full browser support.
Php
Re-changed, the code is more concise
Php
Want to learn, the current ability can not do it ~
Study, a lot of not yet
Excuse me landlord
Is this thing difficult?
This thing will be able to enter Baidu ... Oh ah .... Ha ha haha
A look at the posting time is 3.31 instead of 4.1 I wonder if I have been ahead of April Fool's Day
There's a lot of pros.
It should be April Fool's Day
The JSON data in the code is obtained from the PHP server side. The HTML,JS,CSS code is as follows and does not use any JS frame. Full browser support.
HTML Code
Not bad! The code is simple. However, there is a slight flaw, that is, the contraction after the expansion, and did not revert to the pre-contraction state, and the general experience is inconsistent. If the brother is interested, CSS is also good, you can tripping the front-end related positions.
Baidu Agency Company's drifting over
I've got a couple of these, and it's not that difficult, but I do need more comprehensive knowledge.
Need to push backward, know how to construct a contraction expansion of the html+css, write the matching JS, and then to write a PHP class to be able to construct HTML based on the incoming array output.
Self-realization, do not rely on ready-made, there will be a place to compare time
To get that dotted line of alignment CSS
Baidu is the threshold ah, haha, said do not want to enter
As long as you will do this problem, your ability has been able to enter Baidu! Baidu on this point,,, Baidu is relying on what to make money? Baidu does not rely on technology (development of new products) to make money, Baidu relies on advertising money ... Baidu does not have the technology to make money, so in addition to the above research and development department, find a few cattle, other departments to find the front desk to answer the phone
Reference 21 Floor Rainsilence's reply:
The JSON data in the code is obtained from the PHP server side. The HTML,JS,CSS code is as follows and does not use any JS frame. Full browser support.
HTML Code
......
Like this one? http://hr.baidu.com/www/job/jobDetail.action?jobId=1966
With PHP implementation, as if there is no JS speed fast
With PHP implementation, as if there is no JS speed fast
Output HTML directly with PHP is convenient.
Recursively output HTML with a function that enters an array that meets specific requirements
Of course, you can also PHP output JSON, with JS in the front-end assembly effect, but then the operation is more complex
Even if they do, they don't go in that hellhole.
It's all a master!
This is a little difficult.
is not the landlord will not engage in
Make a gimmick for someone to help you?...
Csdn a master like a cloud
I can't see the picture.
It's too easy.
Not this professional .... The subject is difficult to understand.
Not bad..
Halo, estimated this level into Baidu is a handyman ...
Otherwise it is Baidu do the level of the web too times ...
Again otherwise is LZ come out to bluff people's ...
It's almost a year's experience.
Study ....
All right!!!
It seems easy, but it really takes some time to make it.
1, with PHP recursive assembly JSON + JS assembly HTML and Effects + CSS
2, with PHP recursive direct assembly HTML + CSS + JS effect
3, JS do not write with jquery, or it will be the people despise the question.
It's very powerful, it's hard.
LZ is Baidu's HR bar? Ha ha
The ability does not know how, but, quite can bluff person's.
Although the classic problem is not very difficult ah
This is not a very complicated and profound thing, right?
Halo, this is event marketing, not recruiting
Baidu also is this ability?
Pre-segment View separation for program business logic and processing requests
This data is the model
Write a processing request page.
Create a new service page data into JSON
Return to the foreground page.
Use the Java loop to process the JSON and add it to the DOM.
Bind an event at the beginning of each node to control the display and hiding under that DOM node!
Re-changed, the code is more concise
HTML Code
Sorry, my project just used to AH. Oh
Can't upload the picture, or I'll pass it up and look at it. Ha ha
Http://t.qq.com/hougaoping/mine
So many masters.
I'm going to try it.
Please see:
Pure HTML+JS Implementation
Http://www.bllarchitects.com/demo/demo.html
Limited to the virtual host only support ASP, so only to give the ASP implementation code
The landlord method is not object-oriented, I can also provide asp/php/jsp/c# object-oriented implementation code.
In addition, if there are too many categories, it is best to use Ajax to get a Level 2 classification, if you need code, you can email me
This kind of thing is the proficiency, even if it will do how to grow a programmer even if you do not understand the PHP CSS to get started absolutely fast after writing things will not be worse than the people will write now
is not the landlord will not do, want to stimulate everyone, let you help him do, this application is not a complex algorithm, and no large scale, who can not do, understand the point of PHP HTML CSS JavaScript of the fur of the people are able to do, and this talent a lot
It's not hard to realize.
Show it first, then display and hide it through jquery.
A small recursion can be solved, write the tree structure should be able to easily write
So simple one thing can go into Baidu? Blow it?
I faint is a tree menu ah, but the implementation of code is good or bad to the best
Upstairs is too exaggerated, of course, the interview can be solved (estimated less half an hour, more than an hour will be over)
Not difficult, time consuming
It's not hard.
Baidu is actually very good into. I have a lot of friends next to me ... There's also PHP.