Giter Club home page Giter Club logo

qanda's Introduction

Q and A сайтын тохируулга

  1. app/config/parameters.yml Файлд өөрийн database -ийн тохиргоог бичиж өгнө.

Хийгдсэн байх тохиргоонууд

  1. app/cache, app.logs гэсэн хавтасуудад бүрэн эрх өгнө:

    sudo chmod 777 app/cache app/logs
    
  2. /etc/hosts - дээр host нэмэх:

    echo "127.0.0.1 qanda.dev" | sudo tee -a/etc/hosts
    
  3. apache-server - дээр qanda.local virtualhost тохируулах:

    sudo cp qanda.local.def /etc/apache2/sites-available/qanda.local
    sudo a2ensite qanda.local
    sudo a2enmod rewrite
    sudo service apache2 restart
    
  4. CSS, Javascript гэх мэт static файлууд дээр өөрчлөлт орсоны дараа web дотор тэдгээрийг үүсгэж өгнө:

    app/console assetic:dump
    

qanda's People

Contributors

atulga avatar erkabom avatar temkagranat avatar

Watchers

James Cloos avatar Ariunbayar Baterdene avatar  avatar  avatar

qanda's Issues

New profile page for users

Let there be a page http://localhost/qanda/index.php/profile?user_id=5, assuming this page will show a user profile whose id is 5.

This page will list following user details:

  • Name (not username)
  • Description/Biography
  • Number of questions asked
  • Latest 5 questions
  • Number of answers
  • Latest 5 answers

Seems like we need to add new fields to User model, name and bio. Please allow the user to edit these fields on his/her profile page.

PS: don't forget to add SQL queries needed for the database in migration directory

Paginator as a class

Please allow to print paginator in template as follows:

<?php foreach ($pager->getPages() as $page) {?>
  <?php if ($pager->getCurrentPage() == $page){ ?>
    <?php echo $page ?>
  <?php }else{ ?>
    <a href="#"><?php echo $page ?></a>
  <?php } ?>
<?php } ?>

assuming $pager is an instance from Paginator class.

Rewrite models in Doctrine

Please rewrite current models.php completely in Doctrine. So that no mysql_* functions are used anymore.

Migration script

Please implement migration feature same as khas project.

Don't forget the README file.

Alert or Flash message

When user is registered into QandA, following message is shown:
"Та амжилттай бүртгэгдлээ, нэвтэрч орно уу"

Please change the UI (User Interface) for this message so that it will show in green box as shown in http://getbootstrap.com/components/#alerts

Please also show message for following cases:

  • Add question
  • Update question
  • Add answer
  • Edit profile

404 page

Requirements

When I call error_404_action it should show a friendly 404 error page.

Code requirements

controller.php should have following content:

<?php
function error_404_action(){
    require_once 'templates/error_404.php';
}
?>

templates/error_404.php should have following content:

<?php $title = "Энэ хуудас олдсонгүй" ?>
<?php ob_start(); ?>
<!-- TODO -->
<?php $content = ob_get_clean() ?>
<?php require_once 'layout.php' ?>

templates/layout.php should have following content:

<html>
  <body><?php echo $content ?></body>
</html>

Table name in models

As we can see in model.php table name is used in every query. There might be a case that table name changes (asuult -> question).

Create new property protected $_table = 'table_name' in each of User, Question and Answer models and use this property in queries. For example:

class Question extends Model {
    protected $_table = 'asuult';
    // ...
    static public function getQuestionCount(){
        $sql = sprintf("SELECT COUNT(id) FROM %s", $this->_table);
        // ...
    }
}

Implement your changes in a new branch called I2_table_name_in_models.

Profile page and links

Please add a link to profile page on question show page for the question and answers.

Please translate descriptions for profile and edit profile pages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.