Jump to content

ramchel

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://ramchel.blogspot.com
  • Yahoo
    karthikatindia

Profile Information

  • Gender
    Male
  • Location
    Chennai

ramchel's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, so you basically want differently themed pages whenever a user go to a new page and when he comes to an already visited page you want retain the previously shown theme. fine analyse the following suggestions and decide how much you can take from it, first create the cache table with following structure to cache some query results, theme selection preference etc.. CREATE TABLE cache(session_id, cache_data); I will write an algorithm kind of solution with which you can build the program suitable to your application, STEP 1: retrieve all available templates from your DB and form an array named say arrTemplate STEP 2: choose a template randomly from the array and store the chosen template id in a variable say intTemplateID STEP 3: display the page with all the details and with the template we just chosen STEP 4: now we need to find a way to get a unique page id for the pages user visits so that we need to retain the same theme we have shown before STEP4-SUB-STEP 1: best way of finding unique page id is to use the REQUEST_URI of $_SERVER STEP4-SUB-STEP 2: so create an array variable named say arrTemplatePref and have REQUEST_URI as index and intTemplateID as value to create unique representation for the view user is in STEP 5: now almost after showing the page do the last bit of processing. STEP5-SUB-STEP 1: create an array named say arrCacheData STEP5-SUB-STEP 2: store the arrTemplate in arrCacheData STEP5-SUB-STEP 3: store the arrTemplatePref in sub array of arrCacheData, remember this has to be in sub array because we may need to push some more list of user views into this. so finally this arrCacheData might look like this arrCacheData => Array( 'TEMPLATE_INFO' => Array(1, 2, 3, 4, 5, 6), 'USER_VIEWS' => Array( 'view.php?limit=20&limitstart=50&contentid=23434' => 3, 'view.php?limit=20&limitstart=70&contentid=23434' => 1 ) ) STEP 6: this is time to store the arrCacheData into the table 'cache' we created with 'session_id' as hook. you can serialize the information before storing. Final Implementation: At each page loads, query the cache table to check whether there is any cached data available. if so loads it in an array. At STEP 2, check the cache array before firing the query because remember we store the information in the cache table. At STEP 3, before choosing the template randomly, check the cache array USER_VIEWS sub array using the REQUEST_URI to check whether the user has already visiting the page or not and if so you can retreive the template ID and set that template as current template. thats it we have got a complete cycle of using the cache to storing the cache. I'm not sure how cleary I have defined my solution(today is my second day at PHPFreaks so not sure of forum rules) but I'm sure by this you can acheive what you are trying to do.
  2. Hi, it seems nothing wrong in your tes2.php. but there are few things you need to correct in your form file. first you need to change the name of the hidden date fields. i assume you are not trying to create dynamic hidden field names and you instead of assigning something to 'value' property you ended up assigning to 'name' property. Your problem is more of HTML rather than PHP. so change the HTML code as follows Actual Code: <input type="text" name="userid" /> <input type="hidden" name="$date1" /> <input type="hidden" name="$date2" /> Change To: <input type="text" name="first" value=""/> <input type="hidden" name="date1" value="<?=$date1?>" /> <input type="hidden" name="date2" value="<?=$date2?>" /> Hope this give you helpful info. "Happy Coding" Ramchel
  3. Hi, it seems you are too concerned about going to DB to get something you want when you need. you like to save the db connection, fetch time cost at any rate even though its takes relatively fraction of time considering the advantage we have now in terms of cheap processing units now available. DBs are supposedly made to organize the information much better than we do ourself in array and supposedly made to retrieve information quickly rather than doing our own way through array. saving date in array holds good only in case if you have very less amount of data. but this will be defeated once your data grows and php certainly is not best to handle huge data structures and its not php duty either. so best leave the job to mysql for what its made for. few suggestions to you to avoid unnecessary DB connections, DB queries, processing upon DB return result set are, use singleton pattern to instantiate DB connection in order to avoid multiple DB connections, try to cache the query result whenever and wherever possible to avoid firing repeated queries to DB by employing a good coding practice and thirdly if you have an application that does lots of business logic processing over the DB query result set, cache the processed information either as serialized form in DB or session, this saves query execution time and business logic processing time over and again. hope this gives you some leads "Happy Coding" Ramchel
  4. Hi, Possible problem is with how you configured the PHP to send mails out of the applications. A proper mail configuration is required for sending mails from PHP programs. following are the php.ini variables needs to be set properly for mail to work properly 'sendmail_from' and 'sendmail_path'. Thanks, Ramchel "Happy Coding"
  5. Hi, You can use Joomla 1 series if you just like to use Joomla as an user of its CMS UI. Joomla 1 stable series is pretty much good for any CMS requirements. But at the same time, if you want an good CMS UI and a powerful coding framework to extend/add functionalities of Joomla, its best advisable to go for Joomla 1.5 stable. Joomla 1.5 now offers unmatched programming experience and one can really enjoy using the benefits of modern powerful programming concepts. So its upto you to decide whether you need something for just CMS management(Joomla 1 series) or easy to enhance Joomla 1.5 series. Thanks, Ramchel "Happy Coding"
  6. Hi, Please change the way you use the $_SERVER['PHP_SELF'] variable inside the the quoted string. There are couple of ways of solving this problem. Either remove the single quote around PHP_SELF or add flower brace around the $_SERVER['PHP_SELF'] variable to make the variable usage in a non-ambiguous manner. Present Problematic Code: $form="<form action=\"$_SERVER['PHP_SELF']\" method=\"post\">"; Change To: Possiblity 1: $form="<form action=\"$_SERVER[php_SELF]\" method=\"post\">"; Possiblity 2: $form="<form action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">"; Thanks, Ramchel "Happy Coding"
×
×
  • 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.