Jump to content

cerberus478

Members
  • Posts

    95
  • Joined

  • Last visited

Everything posted by cerberus478

  1. No I haven't. Where would I put that?
  2. I think think the problem is in the recieving page, because the drop down boxes has the correct information. Here is my search.php <div class="top-head-2nd"><h2><div class="right-link" style="text-align:right;"><a href="javascript:;" onClick="history.go(-1)">« Go Back</a></div></h2></div> <?php if(!empty($this->_params['list'])){ ?> <div style="clear:both;"> <div id="region-listings"> <div class="inhoud"> <?php foreach ($this->_params['list'] as $resort){ ?> <table width="100%" border="0" cellspacing="0" cellpadding="8"> <tr> <td width="76%" bgcolor="#404040"><h3><?php echo $resort['name'] ?></h3></td> <td width="24%" bgcolor="#FF9900"><a href="<?php echo $this->get_uri('/resorts/view/'.$resort['id']) ?>">View Resort Profile »</a></td> </tr> <tr> <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="17%"><img src="/image.php?path=<?php echo $resort['image_path'] ?>&w=135&h=89" /></td> <td style="line-height:155%;" width="83%" valign="top"> <?php if(!empty($resort['cheapest_listing'])){ ?> <strong>Shares available from <span class="orange">R<?php echo $resort['cheapest_listing'] ?></span> per share</strong><br /> <?php } if(!empty($resort['lifestyles'])){ ?> <span class="grey"> <?php echo 'Lifestyles: '; $comma = ''; foreach($resort['lifestyles'] as $lifestyle){ echo $comma.$lifestyle['name']; $comma = ', '; } ?> </span><br> <?php } if(!empty($resort['no_of_listings'])){ ?> <strong>(<?php echo $resort['no_of_listings'] ?> Listings)</strong></td> <?php } ?> </tr> <tr> <td colspan="2"> </td> </tr> </table></td> </tr> </table> <?php } ?> </div> </div> </div> <?php } ?>
  3. Hi I have 3 drop down boxes and I want my boxes to go to another page when I select them and click go. For example if I click western cape I want it to give me all the resorts in western cape and if I click western cape and beaches I want it to give me all the resorts that are in the western cape that are next to beaches. I have been able to populate the drop down boxes with information and it can go to another page but it doesn't give me the information I want. This is my drop down boxes code <script type="text/javascript"> function showGo(){ var region_id = $("#region_id").val(); var lifestyle_id = $("#lifestyle_id").val(); var resort_facility_id = $("#resort_facility_id").val(); if((region_id != 'false') || (lifestyle_id != 'false') || (resort_facility_id != 'false')){ $("#destinationSearchButton").css('display', 'block'); }else{ $("#destinationSearchButton").css('display', 'none'); } </script> <form action="/pages/search/" method="post"> <select class="formSelect" name="region_id" id="region_id" size="1" tabindex="1" onchange="showGo()"> <option label="Region"> <?php $regions_model = new regions_model('regions'); $regions = $regions_model -> get_all(); foreach($regions as $region){ $name = $region['name']; $id =$region['id']; $select = "SELECT $id, $name FROM regions"; echo "<option value='$id'>$name</option>"; } ?> </option> </select> <select class="formSelect" name="lifestyle_id" id="lifestyle_id" size="1" tabindex="2" onchange="showGo()"> <option label="lifestyle"> <?php $lifestyles_model = new lifestyles_model('lifestyles'); $lifestyles = $lifestyles_model -> get_all(); foreach($lifestyles as $lifestyle){ $name = $lifestyle['name']; $id = $lifestyle['id']; $select = "SELECT $name FROM lifestyles"; echo "<option name='$id'>$name</option>"; } ?> </option> </select> <select class="formSelect" name="resort_facility_id" id="resort_facility_id" size="1" tabindex="3" onchange="showGo()"> <option label="Facilities & Amenities"> <?php $resort_facilities_model = new resort_facilities_model('resort_facilities'); $resort_facilities= $resort_facilities_model -> get_all(); foreach($resort_facilities as $resort_facility){ $name = $resort_facility['name']; $id = $resort_facility['id']; $select = "SELECT $name FROM resort_failities"; echo "<option name='$id'>$name</option>"; } ?> </option> </select> <input class="formInputButton" type="submit" name="submitButtonName" id="destinationSearchButton" value="Go" tabindex="4"/ style="display: none;" /> </form> </div> Thank you
  4. well thankfully I don't need anymore help because I ended up getting help today from another place.
  5. Hi I have the following code, this code is suppose to get the data from the galleries table and the pages table. I think my problem is the sql statement but I'm not sure. public function galleries(){ foreach($this->_params['list'] as $gallery){ $id = $gallery['id']; $name = $gallery['name']; $select = "SELECT * FROM pages, galleries WHERE pages.name = {$gallery['name']}"; $this->_params['item'] = $this->_model->get(array("pages.name = 'galleries.name'")); } the code $this->_params['item'] = $this->_model->get(array("pages.name = 'galleries.name'")); works just fine with the home page and all the other pages. I have 2 galleries called gallery 1 and gallery 2, now my problem is that I need the sql to go through the galleries table look for the name and then look through the pages table and get the meta data from the same name. There is no foreign id because I only need it for the galleries and nothing else. Thank you
  6. I forgot to mention that on my home page I have 2 links and in the galleries.controller.php is where the database picks up the gallery names and displays them in the links, so when I click the link it goes to the gallery 1 page for example.
  7. thanks for replying where would I put the $content because if I put it into my default.php I get a warning saying that $content is undefined.
  8. I would like to be able to have my meta data pick out the information of a page and insert it into the meta tags. I have a controller class which has the coding to get the data, which is this: controller.class.php function get_title(){ $title=''; if (isset($this->_params['item']['meta_title']) && !empty($this->_params['item']['meta_title'])){ $title=$this->_params['item']['meta_title']; } $title=strip_tags($title); $title=str_replace('"', '\'', $title); $title=trim($title); if (strlen($title)>150){ $end_of_last_sentence=strpos($title, '.', 150)+1; if ($end_of_last_sentence<150){ $end_of_last_sentence=150; } $title=substr($title, 0, $end_of_last_sentence); } return $title; } function get_description(){ $description=''; if (isset($this->_params['item']['meta_description']) && !empty($this->_params['item']['meta_description'])){ $description=$this->_params['item']['meta_description']; } $description=strip_tags($description); $description=str_replace('"', '\'', $description); $description=trim($description); if (strlen($description)>150){ $end_of_last_sentence=strpos($description, '.', 150)+1; if ($end_of_last_sentence<150){ $end_of_last_sentence=150; } $description=substr($description, 0, $end_of_last_sentence); } return $description; } function get_keywords(){ $keyword=''; if (isset($this->_params['item']['meta_keyword']) && !empty($this->_params['item']['meta_keyword'])){ $keyword=$this->_params['item']['meta_keyword']; } $keyword=strip_tags($keyword); $keyword=str_replace('"', '\'', $keyword); $keyword=trim($keyword); if (strlen($keyword)>150){ $end_of_last_sentence=strpos($keyword, '.', 150)+1; if ($end_of_last_sentence<150){ $end_of_last_sentence=150; } $keyword=substr($keyword, 0, $end_of_last_sentence); } return $keyword; } Then I have a pages.controller which has the coding for the home page pages.controller.php public function home(){ //instantiate a model $galleries_model = new galleries_model('galleries'); $galleries = $galleries_model -> get_all(); foreach($galleries as $gallery){ //how to loop through an image so that only the first //image is selected $sql = "SELECT image_path FROM gallery_images WHERE gallery_id = {$gallery['id']} ORDER BY order_by"; $image = $this->_model->get_one($sql); $gallery['image'] = $image; $this->_params['list'][] = $gallery; } $this->_params['item'] = $this->_model->get(array("pages.name = 'home'")); } galleries.controller.php public function galleries(){ $galleries = $this->_model->get_all(); $this->_params['list'] = $galleries; } public function view($gallery_id){ $this->_params['item'] = $this->_model->get($gallery_id); $this->_params['item'] ; //die; } This is my default page where I want the meta tags to echo out the relevent information default.php !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $this->get_title(); ?></title> <meta name="Description" content="<?php echo $this->get_description(); ?>" /> <meta name="Keywords" content="<?php echo $this->get_keywords(); ?>" /> <title>Welcome to the Framework</title> <?php $this->_page->add_javascript('/vendor/lightbox/js/jquery.lightbox-0.5.min.js'); $this->_page->add_stylesheet('/vendor/lightbox/css/jquery.lightbox-0.5.css'); echo $this->page('stylesheets'); echo $this->page('javascripts'); ?> </head> <body> <h1> Welcome to the My site </h1> <?php echo $this->page('view');?> </body> </html> In the pages.controller.php I managed to get it to work using $this->_params['item'] = $this->_model->get(array("pages.name = 'home'")); I want to be able to do the same thing on different pages but I can't get it to work. I hope I explained it clearly. Thank you
  9. thanks to the people that tried to help but I managed to find a solution
  10. I'm using a zend framework. I have a page that has a list of galleries and when I click on the link it takes me to another page called gallery 1 which has the pictures. so what I want is the pages.controller.php to go through my database and give me the first image for that gallery and show it next to the gallery 1 link on my home.php $this->_params['list'][] = $gallery(); is suppose to be a way to link my pages.controller.php to my home.php my home.php has foreach ($this->_params['list'] as $key => $gallery ){ $gallery_name = $gallery['name']; $image = $gallery['image_path']; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<img src='/image.php?path=$image&h=50&w=50'>"; echo "<a href=/galleries/view/".$gallery['id'].">$gallery_name</a>"; echo "</td>"; echo "</tr>"; echo "</table>"; } but it doesn't work.
  11. Hi I have two albums with pictures in them, what I want to know is how do I put the first image of my album next to the albums name. For example I have an album called gallery 1 and I have 2 pictures in it and before you click the link to go see those images i want the first picture to be next to gallery 1. I hope that made sense. Thank you for your help. This is the code I got so far public function home(){ $galleries_model = new galleries_model('galleries'); $galleries = $galleries_model -> get_all(); foreach($galleries as $gallery){ $sql = ("SELECT * FROM gallery_images WHERE id = gallery_id LIMIT 1"); $this->_params['list'][] = $gallery; } } }
  12. Hi Sorry for the late reply but thank you for helping me I finally got it to work
  13. hi I'm so sorry for the late reply. But I have sorted out the problem, but thank you for helping me
  14. Can a person instantiate a model? If so how do you do it. I already know how to instantiate a class thank you
  15. Hi I have a username and password page and when the person enters the details they go to another page or if they are admin they have to go to a diffrent one. Here is my code: if($this->is_admin()){ ?> <ul id="menu"> <li><a href="/admins/home">Home</a></li> <li> <a href="/galleries/galleries">Galleries</a> </li> <li> <a href="/admin/users/logout">Log Out</a> </li> </ul> <?php } ?> <?php echo $this->page('view');?>
  16. Thank you very much nightslyr for your help. You helped me alot.
  17. Would $.get('countries') work and how would I use .htaccess I've seen it before but never used it
  18. Thanks for the quick reply @flappy_warbucks when you say import jquery do you mean <script type="text/javascript" src="whatever.php" ></script> @AyKay47 I'm not sure how to do that and the countries is a controller as far as I know controllers are called like that. And I forgot to mention that I'm using zend studio.
  19. Hi I have a quick question. I want my javascript to be able to access my php page because my php page has the coding to access the database and then it has to give me a list of the stuff in the database the alert box. This is the code that I have. I know that I can use it but I'm not sure how to go about it. getPHPResponse=function(){ var url="/countries/ajax_return_response"; $.post(url, {'format': 'JSON', 'countries': '$countries'}, function(data){ //this is where jsvascript must do something alert(data); }); }
×
×
  • 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.