Jump to content

Search the Community

Showing results for tags 'view'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 6 results

  1. Hi everyone, So I'm relatively new to OO PHP and moreover, OO PHP with MVC design pattern. This may be a largeish post so please bear with me on this one! So here is a scenario that I'd like to understand. There are likely multiple ways to go about this, but it'd be nice to see what is said. I'll include what I think should be the solution here and hopefully i'll get some feedback about it. Scenario: A page needs to display a list of "parts" for a car. A database table already exists with these parts. The list of parts on the page need to be ordered by name on first load, but then can be re-ordered by users using a drop down list. They can also be filtered, and searched. A page also exists to display a single car part. What I think should be, and what i'm struggling with: Model: I will have a "part" object which represents an individual car part. The part object will use a database abstraction layer. On "new Part()" will generate an empty object. ->Load( id ) will load an individual part. Controller: I do not know how I would implement this. I know it would contain methods to Filter(), Search() and Order() and that would directly access the Model. View: I am lost here too, I need to display a list of car parts, and on another page, a single car part. I understand I should use the same Model for both. However I do not see how I would list the parts. Some Questions: Should I have another "model" that is a list of the "Part" model called PaetListModel, or should "Part" be able to generate that list? I clearly should have 2 views, one for singular part, one for list of parts. Should the view access the model to generate the list before using the data for output? Should the controller be used in the view instead of the model to generate the initial list (or singular) on page load? Should the filter functions in the controller reload the "PartsList" from wherever our list is stored? I think the most important question for me though is: How would YOU implement the above green scenario? I would like to learn from peoples examples so I get an idea of what road to follow
  2. Hi All, I am currently trying to learn how to build Joomla Components. I am building a component which will function as a "Magazine Library". I have been following the guide found here and modifying it accordingly to fit my needs: http://docs.joomla.org/J3.2:Developing_a_MVC_Component/Adding_backend_actions I am doing quite well, but I seem to have hit a snag, during development I changed the name of one of the views from journallibraries to journallibrarys, just to make it a little easier to follow the guide. I have the first view which outputs a list of the magazine articles in a table and has a menu at the top to "Add", "Edit" and "Delete". When clicking the Add and Edit function the next view loads fine which shows the form to allow adding or editing of an item. The menu also appears so you can save & close or just close. When I click Save & Close or indeed Close, it redirects to a form which does not exist, which is the "journallibraries" form which was originally in this component. I have been through all of the code and I cannot find a single reference to this view, what I want to know is if anyone has had a similar problem to this, or if anyone knows where the code might be which is responsible for the actions that occur when "Save" is selected. I have uploaded the component admin part (which is all I have done so far), so if anyone has 5 minutes to help me identify this problem I would be eternally grateful! Cheers, Andrew com_journallibrary.zip
  3. I am learning so please excuse my lame questions! Here is what I have so far: Categories, of course and news in there. On the home page I have a box for every category with one main post, a picture and several more posts with titles only. I can make a view for every category with my basic skills but I need to do it the right way (or somehow the right way). It seems to me like some very complicated foreach statement but nothing has come to mind yet. Give me some starting point please. I would be very grateful for any directions, ideas or examples. Thank you! Featured post:http://oi59.tinypic.com/2i7sgwl.jpg Progress: I made it happen somehow Categories boxes:http://oi58.tinypic.com/epopiw.jpg Progress: Here is what I have for now: class Post extends Model { public $rows_posts; public $rows_featured_posts; public $_id; public function get_posts() { $this->_db->query("SELECT * from posts"); $this->rows_posts = $this->_db->resultset(); } public function get_ceatured_posts() { $this->_db->query("SELECT * from posts WHERE featured = 1 LIMIT 1"); $this->rows_featured_posts = $this->_db->resultset(); } } Child Class: class Featured_Publication extends Post { public $rows_featured_posts; public function create_featured_post() { $this->get_ceatured_posts(); foreach ($this->rows_featured_posts as $row_featured_post) { include_once VIEWS_PATH . 'homepage/featured_publication.php'; } } } I can do this for Featured posts, but I don't know how to show the contents from all categories in different boxes. I can only show the category title on the top of each box, but cannot put the posts in there. I suppose this below is wrong because it is not working at all. A class Category: class Category extends Model { public $_rows; public $_id; public function build_category() { $this->_db->query("SELECT * from categories"); $this->_rows = $this->_db->resultset(); } public function category_items() { $this->_db->query("SELECT * from posts WHERE category_id = '{$this->_id}'"); $this->_rows = $this->_db->resultset(); } } Child Class: class Category_Boxes extends Category { public $_rows; public $rows_posts_in_category; public $category_id; public function get_posts_from_category() { $this->build_category(); $this->_db->query("SELECT * from posts WHERE category_id = '{$this->category_id['category_id']}'"); $this->rows_posts_in_category = $this->_db->resultset(); } public function build_category_box() { $this->build_category(); $this->get_posts_from_category(); foreach ($this->_rows as $row) { include VIEWS_PATH . 'homepage/category_box.php'; // Here is my view for the category box } } }
  4. Hi everyone I'm in learning laravel, really a newbie. It's seems somehow I can't pass the variables from controllers to view. So this is what I've got config/route.php Route::get('/' , "PagesController@link"); Route::get('pg' , "PagesController@link"); Route::get('pg/{link}' , 'PagesController@link'); controllers/PagesController.php public function link($link = 'index') { // option 1 return "--->" . $link; // option 2 return View::make('pages.index' , array('link' => $link)); // option 3 return View::make('pages.index')->with('link', $link); // option 4 return View::make('pages.index' , compact('link')); } views/pages/index.blade.php @extends('layouts.frontend') @section('title') @parent - Index file @stop @section('content') <article> <header>This is the {{ $link }}</header> <p>And this is the main body of {{ $link }} file</p> </article> @stop views/pages/layouts/frontend.blade.php <!doctype html> <html> <head> <meta charset="utf-8"> <title> @section('title') Lar4 Test @show </title> {{ HTML::style('css/frontend.css') }} </head> <body> <header id="header"> <div id='banner'> </div> <nav> {{ HTML::link('pg' , 'Home') }} {{ HTML::link('pg/about' , 'About Us') }} </nav> </header> <section> @yield('content') </section> <aside> </aside> <footer> </footer> </body> </html> So if I browse to <site>/pg/sometext only option 1 will work (shows "---->sometext"), all others will thrown an error "Undefined variable: link". If I comment both {{ $link }}, both layout and index views are successfully rendered. Any idea of what am I doing wrong?
  5. I have stored a image in database as it is small dd not upload in folder it got uploade and is shown in database i stored it with using $imgData =addslashes (file_get_contents($_FILES['image']['tmp_name'])); then a insert query with $imgData Now when i retrive it with select query from database and display <td rowspan="12"><?php header('Content-type:image/jpg'); $img=stripslashes($info['image']); echo $img; ?></td> it shows The image "localhost/final/../f.php?action="view&id=53" cannot be displayed because it contains errors
  6. hello Php Freaks, i have manage to make a search box and view the student name listed on the database with a link VIEW, EDIT, DELETE on the left side. My problem is i wanted that when i click the VIEW it must direct to a specific student which name appeared on the right side. This is my ajax.php code. $display_string = "<table border='1' cellpadding='10' cellspacing='1' align='center'>"; $display_string .= "<tr align='center'>"; $display_string .= "<th>LR Number</th>"; $display_string .= "<th>F i r s t N a m e</th>"; $display_string .= "<th>L a s t N a m e</th>"; $display_string .= "<th>Grade</th>"; $display_string .= "<th>Section</th>"; $display_string .= "<th>View</th>"; $display_string .= "<th>Update</th>"; $display_string .= "<th>Delete</th>"; $display_string .= "</tr>"; // Insert a new row in the table for each person returned while($row = mysql_fetch_array($qry_result)){ $display_string .= "<tr>"; $display_string .= "<td>$row[LRN]</td>"; $display_string .= "<td>$row[first_name]</td>"; $display_string .= "<td>$row[last_name]</td>"; $display_string .= "<td>$row[grade]</td>"; $display_string .= "<td>$row[section]</td>"; $display_string .= "<td><a href='View_Profile.php?userID=$row[student_id]'>View</a> </td>"; $display_string .= "<td><a href='Admin_Edit_Student_Info.php?userID=$row[student_id]''>Update</a></td>"; $display_string .= "<td><a href='Admin_Delete_Student.php?userID=$row[student_id]''>Delete</a></td>"; $display_string .= "</tr>"; and this is the Student_home.php <p align="left"> </p> <p align="left"><span class="stylebig">LEARNERS INFORMATION</span></p> </blockquote> <table width="85%" align="center"> <tr class="stylesmall"> <td height="50" align="left" valign="middle" class="style3 style8"> LRN</td> <td align="left" valign="middle" class="style8"> </td> <td align="left" valign="middle" class="style8"> </td> <td class="style8"> </td> </tr> <tr class="stylesmall"> <td width="142" height="50" align="left" valign="middle" class="style8">First Name</td> <td width="177" align="left" valign="middle" class="style8"> </td> <td width="151" align="left" valign="middle" class="style8">Last Name</td> <td width="159" class="style8"> </td> </tr> <tr class="stylesmall"> <td width="142" height="50" align="left" valign="middle" class="style8">Gender</td> <td align="left" valign="middle" class="style8"> </td> <td align="left" valign="middle" class="style8">Date Of Birth</td> <td class="style8"> </td> </tr> <tr class="stylesmall"> <td width="142" height="50" align="left" valign="middle" class="style8">Grade</td> <td align="left" valign="middle" class="style8"> <td align="left" valign="middle" class="style8">Contact No</td> <td class="style8"> </td> </tr> <tr class="stylesmall"> <td width="142" height="50" align="left" valign="middle" class="style8">Primary Email</td> <td align="left" valign="middle" class="style8"> </td> <td align="left" valign="middle" class="style8">Secondary Email</td> <td class="style8"> </td> </tr> <tr align="left" valign="middle" class="stylesmall"> <td width="142" height="50" class="style8">Address</td> <td class="style8"> <tr align="left" valign="middle" class="stylesmall"> <td width="142" height="50" class="style8">Description</td> <td class="style8"> <td class="style8"></td > </tr > </table> </div> i think i miss some lines of codes in the target page (Student_home.php). Please i am a newly practicing php coder. Help me clarify lines which i have mistaken and how to replace/correct/insert on the proper place. God bless everyone,
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.