Re: [PHP] Was: Putting Evaluated Contents...
Hey, Now, how about taking that variable and executing it? How might one do this? For instance: I might have an asp page on one server(Yeah, I have to use asp on that server) generate the results in the form of a bit of php code, and pass it to my php script via include method for execution. When the php page gets the results I could execute this? Would I have to put the ob_start()... ob_get_clean(); within a function? How would I execute it? I am thinking of this way as my php pages use a templating system, and I would like to take the data from the asp results and shoot them into my template object for rendering. just expanding off the conversation. -Brian > Michael Stearne wrote: > > Hi, > > > > I have an file that contains PHP code..variables, db, etc. Is it > > possible to include the evaluted contents of that file into a variable > > in another, the calling PHP script? > > > > Essentailly I am looking to do something like > > > > include("myCode.php") -> HTML Output -> $myVariable. > > > > I know could do this with something like > > $myVariable=file_get_contents("http://localhost/myCode.php";) but I am > > not allowed to use urls in file opens. > > use output buffering functions: > > ob_start(); > include("myCode.php"); > $myVariable = ob_get_clean(); // available since 4.3.0 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems including a url with query string variables
I am having a difficulty including a url and passing it to an include statement between it. The problem is when I have a plain url it works, but if I try to pass it something to the query string it does not. Is there some way to format the string differently before including it? ob_start(); ... $result = ob_get_clean(); The below example works: -- $URL = "http:/-.-.-.-/datachange.asp"; ob_start(); include("$URL"); $message = ob_get_clean(); The below example does not work: -- $URL = "http:/-.-.-.-/datachange.asp$queryString"; ob_start(); include("$URL"); $message = ob_get_clean(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems including a url with query string variables
let me try it again... The below example works: -- ob_start(); include("http:/-.-.-.-/datachange.asp"); $message = ob_get_clean(); The below example does not work: -- $URL = "http:/-.-.-.-/datachange.asp$queryString"; ob_start(); include("$URL"); $message = ob_get_clean(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems including a url with query string variables
> > The below example works: > > -- > > > > ob_start(); > > include("http:/-.-.-.-/datachange.asp"); > > $message = ob_get_clean(); > > > > > > The below example does not work: > > -- > > $URL = "http:/-.-.-.-/datachange.asp$queryString"; > > ob_start(); > > include("$URL"); > > $message = ob_get_clean(); > > > Does $queryString contain the leading '?', or do you need to add it, as > below: > > $URL = "http:/-.-.-.-/datachange.asp?$queryString"; > > Kirk Yes it includes a "?". I am thinking it might be a problem with the order of processing. Includes first , then everything else Is there any way to include a file only after a conditional? -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sorting arrays
Say I place the results of a set of database queries -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sorting arrays
Say I create a "matches" array from a set of SQL queries With each query, an entry is added to my matches array. If the name already exists, its value gets incremented. How can I sort the array based on the highest number of hits? What is the sort method? Say this is the array: array('lma-bg51' => 1, 'mcr-vh14' => 2, 'gmc-rr21' => 5, 'amh-fg23' => 1) -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: sorting arrays
> RTFM > arsort() Ok, so I use asort(), and I don't get the result I wanted. Instead I get the script telling me my foreach loop is wrong on the second test round, as if it did something other than simply sort the array. It seems that I can't access the array now? $nar = array('lma-bg51' => 1, 'mcr-vh14' => 2, 'gmc-rr21' => 5, 'amh-fg23' => 1); foreach( $nar AS $key => $val ) { echo "$key: $val"; } $nar = asort($nar); foreach( $nar2 AS $key => $val ) { echo "$key: $val"; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting arrays
Right! That fixed it. I was doing it like this: $nar = asort($nar); which gave me a boolean result When I should have done it like this: asort($nar) ; reset($nar); I didn't understand the return of an asort was boolean and not the processed array itself. Thanks, -Brian - Original Message - From: "Chris Rose" <[EMAIL PROTECTED]> To: Sent: Tuesday, March 08, 2005 5:26 PM Subject: RE: [PHP] sorting arrays > > Say I create a "matches" array from a set of SQL queries with each > query, > > an entry is added to my matches array. If the name already exists, its > > value > > gets incremented. How can I sort the array based on the highest number > of > > hits? > > > > What is the sort method? Say this is the array: > > > > array('lma-bg51' => 1, 'mcr-vh14' => 2, 'gmc-rr21' => 5, 'amh-fg23' => > 1) > > http://uk2.php.net/manual/en/function.asort.php > > Is that what you're looking for? > > Thanks. > > Kind Regards, > Chris Rose > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reverse plural forms to singular for search
I was looking into that a month or so ago. Here's an article that mentions the Porter Stemming Algorithm http://www.scit.wlv.ac.uk/seed/docs/mypapers/stemalg.html and the official home http://www.tartarus.org/~martin/PorterStemmer/ I don't know if this is of interest. -Brian Anderson - Original Message - From: "Mark Rees" <[EMAIL PROTECTED]> To: Sent: Friday, April 15, 2005 3:14 AM Subject: FW: [PHP] Reverse plural forms to singular for search > Eugene, your reply-to address is set > > -Original Message- > From: Mark Rees > Sent: 15 April 2005 09:08 > To: 'Eugene Voznesensky' > Subject: RE: [PHP] Reverse plural forms to singular for search > > > That sounds like a nightmare! Assuming you are talking about English, > you might be able to make some progress by removing trailing s or es for > words. This would trim words down to their stem. You could do this with > a regular expression, which will need to do something like look for es > or s with no preceding s at the end of words (to avoid trimming words > like glass). > > It will not catch forms like medium/media and thesis/theses. You could > think about trying to trim words like that down to their stem (med in > this case). In fact, would just trimming off the last two letters and > searching for that do for you? It depends on the range of words you are > searching for. > > Good luck > > Mark > > -Original Message- > From: Eugene Voznesensky [mailto:[EMAIL PROTECTED] > Sent: 14 April 2005 17:22 > To: php-general@lists.php.net > Subject: [PHP] Reverse plural forms to singular for search > > > I'm trying to reverse plural forms to singular ones > and use the result for search [in database]. > > Is there any third party product to integrate with > PHP, or some reliable algorithm? > > Thank you, > > Eu. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Gamma Global : Suppliers of IBM, Compaq, Cisco, Sun Microsystems, 3Com and HP Products. > > GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 2000' REGISTERED COMPANY > > ** > > CONFIDENTIALITY NOTICE: > > This Email is confidential and may also be privileged. If you are not the > intended recipient, please notify the sender IMMEDIATELY; you should not > copy the email or use it for any purpose or disclose its contents to any > other person. > > GENERAL STATEMENT: > > Any statements made, or intentions expressed in > cessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content > herein may be held binding upon Gamma Global (UK) Ltd or any associated company > unless confirmed by the issuance of a formal contractual document or > Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com > > E&OE > > ** > ** > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hello, I'm new...
Think he means a CMS || Forumpackage || Portal package? www.opensourcecms.com -brian - Original Message - From: "Jason Barnett" <[EMAIL PROTECTED]> To: Sent: Friday, May 13, 2005 3:20 PM Subject: Re: [PHP] Hello, I'm new... > [EMAIL PROTECTED] wrote: > >>>I would like to create a 'community' website and was wondering if > >>>there > >>>was a framework available to get me started? > > > > > > Well now I don't even know what a framework is. I was expecting > > someone to say "Oh, you should use model view controller" or > > something. > > > > All the answers seem to be applications. > > > > Are applications frameworks? > > > > J > > I would call MVC a design pattern... but then again I never took a CS > class in college so my knowledge of the lingo might be lacking. > > In any case based on the responses others have given to the OP > (including your own responses) there are really multiple questions that > you need to address: > > - what content / features do you want? > - what kind of user interface do you want? > - do you want a solution that is fully integrated? >- If so, then also consider the licensing options for each solution. > - If you don't want the full integration then you get to other questions > like: >- what design pattern fits my overall application? (likely MVC) >- what pre-existing code does the best job for each part of my site? >- what amount of flexibility do I want to build into my application? >- what can I do to make this code as easy as possible to understand > in the future, because I or someone else will have to debug it later? > > > I'm missing a lot of questions out of my list, but it gets you started. > Really it comes down to having a good mental picture of what it is you > want the site to do and how it will work / look / feel. Then you get > all of that down on paper and start finding code / packages / tutorials > to fill in the blanks. > > Based on the somewhat vague OP, you have somewhat vague (but somewhat > useful) answers. ;) > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] silly question - setting .php as default extension (Apache)
Uuuuh... Where do I set the default server extension type to .php in the apache config? Right now the page will execute on my server, but if there is an index.php the server won't automatically open it, but instead browses the directory. Thanks in advance, -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] silly question - setting .php as default extension (Apache)
Coolbeans guys! :) Thanks, -Brian - Original Message - From: "Marek Kilimajer" <[EMAIL PROTECTED]> To: "Brian A. Anderson" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, November 09, 2004 4:07 PM Subject: Re: [PHP] silly question - setting .php as default extension (Apache) > Brian A. Anderson wrote: > > Uuuuh... Where do I set the default server extension type to .php in the > > apache config? Right now the page will execute on my server, but if there is > > an index.php the server won't automatically open it, but instead browses the > > directory. > > DirectoryIndex index.html index.php ... > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] converting whole or tenth prices to double decimal
Anybody know the easiest way to convert a number like 2.1 to $2.10 or 2 to $2.00? Silly question? -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] converting whole or tenth prices to double decimal
I found it $strprice1 = number_format($strprice1, 2, '.', ''); - Original Message ----- From: "Brian A. Anderson" <[EMAIL PROTECTED]> To: Sent: Thursday, December 23, 2004 6:25 AM Subject: [PHP] converting whole or tenth prices to double decimal > Anybody know the easiest way to convert a number like 2.1 to $2.10 or 2 to > $2.00? > > Silly question? > > -Brian > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] searching and sorting
I am new(relatively) to php programing and searching. I am trying to understand the best way to access data and deliver results to searches on a product catalog website. I have two kinds of data that I am sorting and displaying results for. The first is info about specific products, and the other is text based general information, notes, and specials that will be stored in a database as well. My question is what is the best way to format and sort all of this info before results delivery. I am thinking of incrementally adding the resultant hits into two associative arrays with the link to the data and a calculated relevance value, and sorting this array by these relevences. One array would be for text data links and another would be for catalog item links. If I have two arrays(sorted), than I could display them like Amazon.com does with products in the main display area(with pictures), and text links to the side. Am I thinking of an efficient way to go about this, or not? I wonder if anyone has more experience, or some suggested resources in understanding building good search building? I would like to find such a book or resource that maps out good search and results procedures. -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] searching and sorting
Quoting: "Richard Lynch" <[EMAIL PROTECTED]> > Unless you KNOW your site will get loads of traffic from the get-go, I'd > focus more on the SIMPLE solutions that you can maintain as a beginner. Quoting: "Richard Lynch" > Unless you KNOW your site will get loads of traffic from the get-go, I'd > focus more on the SIMPLE solutions that you can maintain as a beginner. well, I have implemented a simple solution, and it is working, but I am thinking in terms of in the coming year or two of developing more sophisticated strategies. > Also depending on the size and scale and scope of your data, I'm not sure > that two separate lists is a Good Idea. Why not? I have arount 1000 products and many searches bring up more than a few pages worth of data. I would think that it might be good to present the links to test files along the side. Here is a link to the actual site: http://www.apsistl.com/ > Amazon may need it for, their zillion items they sell, but do you, really? > > I've spent *DAYS* writing special search engines for data-sets that only > had 100 items in them, and would never grow significantly larger than > that. I told my client that was pretty wasteful of their money, but > that's what they wanted. [shrug] Pays the bills. But that doesn't mean > you want to waste your money/time that way. Right now the people visiting my website are complaining that when they search for "sports cars" for instance, that they get many sports items sorted first before they even get to see the "sports cars". I realize that this is a separate issue, but it illustrates that even though my search is working, it could be improved. I look forward to figuring out how to do it better. Regardless, my data sets may not always be limited to 1000 products (not to mention the text pages). > One Axiom: Keep as much of the scoring/sorting in your SQL as possible -- > That's what SQL engines are best at. I agree. That is a wise statement, and I have tried to do this with regular expressions but this doesn't deal with relevance at all, or is there something that I am missing? I suppose I could do multiple searches on my data to look for "sports cars" first, "cars" second, and "sports" last. Then I could deal with the separate issue of the text files. -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php