Jump to content

ksduded

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ksduded's Achievements

Member

Member (2/5)

0

Reputation

  1. I am trying to use the return value from a function, but I don't know how to save it inside a variable. I tried this $j = return array_slice($rows, 0, $items); but it didn't work Right at the end of the code is return array_slice($rows, 0, $items); Is this value being saved inside a variable in the code provided? if not, how can I save it? The code is defined('_JEXEC') or die('Restricted access'); require_once (JPATH_SITE . '/components/com_content/helpers/route.php'); class modYOOcarouselHelper { function renderItem(&$item, &$params, &$access) { global $mainframe; $user =& JFactory::getUser(); $item->text = $item->introtext; $item->groups = ''; $item->readmore = (trim($item->fulltext) != ''); $item->metadesc = ''; $item->metakey = ''; $item->access = ''; $item->created = ''; $item->modified = ''; if ($params->get('readmore')) { // Check to see if the user has access to view the full article if ($item->access <= $user->get('aid', 0)) { $linkOn = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid)); } else { $linkOn = JRoute::_('index.php?option=com_user&task=register'); } $item->linkOn = $linkOn; } require(JModuleHelper::getLayoutPath('mod_yoo_carousel', '_item')); } function getList(&$params, &$access) { global $mainframe; $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $aid = $user->get('aid', 0); $catid = (int) $params->get('catid', 0); $items = (int) $params->get('items', 0); $order = $params->get('order', 'o_asc'); $contentConfig = &JComponentHelper::getParams( 'com_content' ); $noauth = !$contentConfig->get('shownoauth'); $nullDate = $db->getNullDate(); jimport('joomla.utilities.date'); $date = new JDate(); $now = $date->toMySQL(); // Ordering switch ($order) { case 'm_dsc': $ordering = 'a.modified DESC, a.created DESC'; break; case 'h_dsc': $ordering = 'a.hits DESC, a.created DESC'; break; case 'c_dsc': $ordering = 'a.created DESC'; break; case 'o_asc': default: $ordering = 'a.ordering'; break; } // Query to determine article count $query = 'SELECT a.*,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'. ' CASE WHEN CHAR_LENGTH(cc.name) THEN CONCAT_WS(":", cc.id, cc.name) ELSE cc.id END as catslug'. ' FROM #__content AS a' . ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . ' INNER JOIN #__sections AS s ON s.id = a.sectionid' . ' WHERE a.state = 1 ' . ($noauth ? ' AND a.access <= ' .(int) $aid. ' AND cc.access <= ' .(int) $aid. ' AND s.access <= ' .(int) $aid : ''). ' AND (a.publish_up = "'.$nullDate.'" OR a.publish_up <= "'.$now.'" ) ' . ' AND (a.publish_down = "'.$nullDate.'" OR a.publish_down >= "'.$now.'" )' . ' AND cc.id = '. $catid . ' AND cc.section = s.id' . ' AND cc.published = 1' . ' AND s.published = 1' . ' ORDER BY ' . $ordering; $db->setQuery($query); $rows = $db->loadObjectList(); if ($order == 'rnd') shuffle($rows); return array_slice($rows, 0, $items); } }
  2. wow you guys are great... thanks for all the suggestions..... I was banging my head on the wall before I came here..
  3. Ok, I am being a complete noob here, but I don't want the echo out the result. Just store it in the $str variable. Otherwise it is working out perfectly. Thanks
  4. Thanks, this worked for me to an extent. However, I want to first check whether the string has CATEGORY: in it before exploding it.... if it does not, then it can move ahead.... This is what I am doing $str = $title; $title = next(explode(': ', $str)); $title has the string... it can be either ITEM or CATEGORY: ITEM (and it keeps on changing according to the different web page), so ideally i would first check for CATEGORY: inside the title, and if found then only do the explode function.... how do I go about that.
  5. I want to check for the word CATEGORY: inside a string which can be CATEGORY: ITEM and remove the word CATEGORY: leaving only ITEM inside the string.... In case the string does not have CATEGORY: before listing the ITEM then nothing happens... Thanks
  6. I am trying to make an instant quote calculator, but having some trouble. I want to display the result of the calculation in the textbox with id price. <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>OVP Custom Order</title> <script language="javascript"> <!-- function calcul(){ var vmin = document.getElementById('dur_min')[document.getElementById('dur_min').selectedIndex].value; var vsec = document.getElementById('dur_sec')[document.getElementById('dur_sec').selectedIndex].value; var vscript = document.getElementById('script')[document.getElementById('script').selectedIndex].value; var vvstock = document.getElementById('vis_stock')[document.getElementById('vis_stock').selectedIndex].value; var vvvideo = document.getElementById('vis_video')[document.getElementById('vis_video').selectedIndex].value; var vvanim = document.getElementById('vis_anim')[document.getElementById('vis_anim').selectedIndex].value; var vvoice = document.getElementById('voice')[document.getElementById('voice').selectedIndex].value; var vmusic = document.getElementById('music')[document.getElementById('music').selectedIndex].value; vmin = vmin*1; vsec = vsec*1; vscript = vscript*1; vvstock = vvstock*1; vvvideo = vvvideo*1; vvanim = vvanim*1; vvoice = vvoice*1; vvmusic = vvmusic*1; var overhead = 547; cost = (vmin+vsec)*(vscript+vvstock+vvvideo+vvanim+vvoice+vmusic+overhead); document.getElementById('price').value = cost; } // --> </script> </head> <body> <form id="form1" name="main"> <label>Duration <select id="dur_min"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> </select> </label> mins <label> <select name="dur_sec" id="dur_sec"> <option value="0">00</option> <option value="0.25">15</option> <option value="0.5">30</option> <option value="0.75">45</option> </select> </label> seconds<br /> <label><br /> Script Provided by <select name="script" id="script"> <option value="0">Client</option> <option value="200">OVP</option> </select> </label> <br /> <br /> Visuals<br /> <label> <input value="100" type="checkbox" name="vis_stock" id="vis_stock" /> Stock Image Library</label> <br /> <label> <input value="300" type="checkbox" name="vis_video" id="vis_video" /> Video Shoot</label> <br /> <label> <input value="200" type="checkbox" name="vis_animation" id="vis_animation" /> Animation & Graphics</label> <br /> <label><br /> Voiceovers <select name="voiceovers" id="voiceovers"> <option value="0">No</option> <option value="200">Yes</option> </select> </label> <br /> <label><br /> Royalty Free Music <select name="music" id="music"> <option value="0">No</option> <option value="50">Yes</option> </select> </label> <br /> <br /> Output Format(s)<br /> <label> <input type="checkbox" name="out_web" id="out_web" /> Web</label> <label> <input type="checkbox" name="out_dvd" id="out_dvd" /> DVD</label> <label> <input type="checkbox" name="out_download" id="out_download" /> Download</label> <br /> <br /> <label> <input type="submit" name="submit" id="submit" value="Calculate" onClick="calcul()"/> </label> <label>Approximate Price <input name="price" type="text" id="price" size="10" virtual warp="on" /> </label> <br /> </form> </body> </html>
  7. Your guess is correct. Are you using free hosting? I've known it be disabled on those kind of hosts before. i am using a dedicated server with iweb.com and I can't find the php.ini .... there is a comment that i need to remove to make cURL work.... WHM is too confusing
  8. I tried that and got this error instead: Fatal error: Call to undefined function curl_init() I am guessing that my php does not include the cURL library? It is php 5+ so I assumed that it should be included
  9. I am trying to place a twitter feed on my php page. I am following this tutorial: http://frankkoehl.com/2008/11/display-twitter-updates-on-your-website/ It uses the cURL functions. I have php 5+ so I am assuming its built in. However I get the error: Fatal error: Call to undefined function twitter_status() The programmer of the code suggested to ask other php'ers, so I present my case to you. I have put the fuction twitter_status(etc..... inside the <head> tags within <script type='text/javascript'> This is my code: <!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> <script type='text/javascript'> function twitter_status($twitter_id, $hyperlinks = true) { $c = curl_init(); curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml"); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3); curl_setopt($c, CURLOPT_TIMEOUT, 5); $response = curl_exec($c); $responseInfo = curl_getinfo($c); curl_close($c); if (intval($responseInfo['http_code']) == 200) { if (class_exists('SimpleXMLElement')) { $xml = new SimpleXMLElement($response); return $xml; } else { return $response; } } else { return false; } } <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </script> <title>Untitled Document</title> </head> <ul> <?php if ($twitter_xml = twitter_status('61289623')) { foreach ($twitter_xml->status as $key => $status) { ?> <li><?php echo $status->text; ?></li> <?php ++$i; if ($i == 1) break; } ?> <li><a href="http://twitter.com/YOUR_PROFILE_HERE">more...</a></li> <?php } else { echo 'Sorry, Twitter seems to be unavailable at the moment...again...'; } ?> </ul> <body> </body> </html> any help will be greatly appreciated
  10. I am expecting a lot of traffic over the weekend only due to a massive campaign. I have a mysql database with 4 databases of average 800 Kib each. At a given php page... around 30 records are shown with 13 fields each. Basically its a calender of shows for a particular month. I also have a search function which parses the whole table for searched string..... I am thinking of making the search function temporarily unavailable so that I can reduce the load. Is there any another methods which can help?
  11. I have a search function which takes input from the user and then goes through my records searching in a few fields for the keyword and then prints out the results. $resulttime picks up the timings from a field called prog_time2 $sql is my search query (which seems to be working fine) $resulttime = mysql_query("SELECT *, TIME_FORMAT( prog_time, '%l:%i %p') AS prog_time2 from rushhd_schd"); $sql = "SELECT * FROM rushhd_schd WHERE prog_programname LIKE '%{$string}%' OR prog_episodename LIKE '%{$string}%' OR prog_episodedesc LIKE '% {$string} %' ORDER BY prog_date ASC"; $query = mysql_query($sql); while ($info = mysql_fetch_array($query)) { //echo out the results { $ptime = mysql_fetch_array($resulttime); ...... The problem is that even though the search is picking up the right records, my resulttime is not picking up the data from the field associated with that record. It just picks up the field from the first record. Which is quite evident from my coding.... How should I change it so that my resulttime only picks up the prog_time field from only the searched query. Thank you
  12. I am planning to have multiple joomla sites which will need a login to get access to. There will be only one username/password to access all the websites, but I want to share the session when the user goes from one joomla site to another. So that once the user has entered through the login area, the different sites do not ask for the user to log in again and again. All the joomla sites will be saved on the same server in different directories. I have not found any joomla module that helps me do this, so I am guessing incorporating a simple log in system through php is the key. But how do i keep the session going on multiple joomla sites. Thanks
×
×
  • 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.