Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    Jul 2013
    Posts
    12
    Member #
    36733

    Symfony2 - HELP for website!?Specific questions to understand where to start?

    Hello,

    i have started coding a project around 10 days now and every day i am learning something new. This website is about visiting the webpage and then int the homepage a list of image slideshows is appeared. Each slideshow represent a project and is a link to this very project.

    Here is a first attempt of coding the very first ProjectsList page in my website:

    Code:
        <title>Zaboratory</title>
        <link rel="stylesheet" type="text/css" href="styles/home.css">
        
    </head>
    
    <body>
        
        <div id="wrap">
            <h1 id="logo">
                <a class="links" href="http://www.zaboratory.com">Zaboratory</a>
            </h1>
            <div id="wrap-content">
                <div id="content">
                    <aside id="results-share-links">
                        <p id="results-count">
                            Search Results:
                            <span>
                                <?php
                                    echo countProjects();
                                ?>
                            </span>
                        </p>
                    </aside>
                    <ul id="results" class="thumbs isotope"
                        style="background-image: none; position: absolute; left: 0px; top: 0px; transform: translate(204px, 0px);">
                        <?php    
                            getProjects();
                        ?>
                    </ul>
                </div>
            </div>
        </div>
    
    </body>
    </html>
    and here is the functions.php file:

    Code:
    <?php
        require ("connection.php") ;
             
         
         function getProjects() {
            global $con;
            $result1 = mysqli_query($con,"SELECT * FROM Projects") or die(mysqli_error());
            $result2 = mysqli_query($con,"SELECT * FROM Projects_Images") or die(mysqli_error());
                                
                                //creating $project_image array!
                                $j = 0;
                                while ($project_image = mysqli_fetch_array($result2)) {
                                    //$j++;
                                    //$i_id[$j] = $project_image['Image_ID'];
                                    //$i_title[$j] = $project_image['Image_Title'];
                                    //$i_description[$j] = $project_image['Image_Description'];
                                    //$i_path[$j] = $project_image['Image_Path'];
                                    //$p_id[]
                                }
                            
                                if (mysqli_num_rows($result1) == 0) {
                                    echo "<p>" . "No projects were found" . "</p>" ;   
                                } elseif ((mysqli_num_rows($result2)) == 0)  {   
                                    echo "<p>" . " No Project Images were found!" . "</p>";           
                    
                                } else {
                                    while ($project=mysqli_fetch_array($result1)) {
                                        $j=$project['Project_ID'];
                                            echo "<li id='item-" . $project['Project_ID'] . "' class='result tile isotope-item'
                                            style='background-image: none; position: absolute; left: 0px; top: 0px; transform: translate(204px, 0px);'>";
                                                echo "<div class='slideshow carousel-clip' style='overflow: hidden; position: relative; height: 124px;'>";
                                                    echo "<div class='carousel-car' style='height: 124px; width: 99999px; position: relative;'>";
                                                        echo "<ul class='images'>";
                                                            
                                                            $result3 = mysqli_query($con, "SELECT Project_ID FROM Projects_Images WHERE Project_ID=$j") or die(mysqli_error());
                                                            while ($project_image = mysqli_fetch_array($result3)) {
                                                                echo "<li class='preload' style=' position: absolute; left: 0px; top: 0px;'>"; // display:none;   
                                                                    echo "<a class='thumb-link' href='project.php?id'>";
                                                                        echo $project_image['Image_Title'];
                                                                        echo "<img width='176' height='124' name='slide' alt='' src='services/downloads/P9140228.JPG' style='height: 124px; width: 176px; '></img>";
                                                                    echo "</a>";
                                                                echo "</li>";
                                                            }
                                                        echo "</ul>";
                                                    echo "</div>";
                                                echo "</div>";
                                                echo "<a class='caption' title='" . $project['Project_Title'] . "' href='http://www.zaha-hadid.com/architecture/cma-cgm-headquarters/'>";
                                                    echo $project['Project_Title'];
                                                echo "</a>";
                                            echo "</li>";
                                        
                                            
                                        
                                    }
                                }
                                mysqli_close($con);
            
        }
        
        function addProjects($Project_Title, $Project_Description, $Project_Team, $Project_Year, $Project_Category, $Project_Style) {
            global $con;
            
            $sql = mysqli_query("INSERT INTO Projects VALUES (null, '$Project_Title', '$Project_Year', '$Project_Category', '$Project_Style')");
            if (!mysqli_query($con,$sql))
                {
                    die('Error: ' . mysqli_error($con));
                }
            echo "1 record added";
    
            mysqli_close($con);
        }
        
        
        
        function deleteProjects($id) {
            global $con;
            $id = (int) $id;
            $result = mysqli_query($con,"DELETE FROM Projects WHERE Project_ID='$id'") or die(mysqli_error());
            header ("Location: projects.php");
        }
        
        function uploadFile() {
            if ($_FILES["Project_Images"]["error"]) {
                echo "Error: " . $_FILES["Project_Images"]["error"] . "<br>";
            } else {
                echo "Upload: " . $_FILES["Project_Images"]["name"] . "<br>";
                echo "Type: " . $_FILES["Project_Images"]["type"] . "<br>";
                echo "Size: " . ($_FILES["Project_Images"]["size"]/1024) . " kB<br>";
                echo "Stored in: " . ($_FILES["Project_Images"]["tmp_name"]);
            }
            
        }
        
        function countProjects() {
            global $i;
            global $con;
            $result = mysqli_query($con,"SELECT * FROM Projects") or die(mysqli_error());
                $i=0;
                while($project = mysqli_fetch_array($result))
                    {
                        $i++;
                        
                    }
                return $i; 
                mysqli_close($con);
        }
        
        
        
    ?>
    So my question is: Where should i start for getting this into symfony2 and then continue from there? I have started creating the routing.php controller.php. I would like to say that i have started a basic cms with a login screeen, listing projects, deleting, adding projects.

    So, any help?

    Thanks,

    zabrielza

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:32 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com