Forum Replies Created

Viewing 15 replies - 31 through 45 (of 60 total)
  • Forum: Plugins
    In reply to: Capabilities Manager
    Thread Starter tsalagi

    (@tsalagi)

    I solved the problem! Instead of using

    <a href="<?php bloginfo('url') ?>/wp-admin/post-new.php"></a>
    Instead use:
    <a href="<?php echo get_option('home'); ?>/wp-admin/page-new.php"></a>

    Thread Starter tsalagi

    (@tsalagi)

    I solved the problem! Instead of using

    <a href="<?php bloginfo('url') ?>/wp-admin/post-new.php"></a>
    Instead use:
    <a href="<?php echo get_option('home'); ?>/wp-admin/page-new.php"></a>

    This is a great plug-in. I hope the support and updates will last.

    Hi. Did you ever get this figured out?

    Thread Starter tsalagi

    (@tsalagi)

    I wasn’t aware of that. Thanks for the info. I’ll get right on it.

    Thread Starter tsalagi

    (@tsalagi)

    Correction.

    For those who want to know, you can use this line of code.
    ‘<script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/js/maxrating.js”></script>’

    Do not just use that line of code. Replace it with your own path and file name.

    Thread Starter tsalagi

    (@tsalagi)

    Okay. Well I appreciate your time. Have fun.

    Thread Starter tsalagi

    (@tsalagi)

    Hey. Thanks for helping out. I forget that others have the luxury of work. I’m unemployed and I promised my wife I would learn a new career so I’m spending all of my time learning WordPress, PHP, MySQL and Javascript. I am working on this about 15 hours a day so I’m sorry that I made it sound if you were not helpful. I’m getting the hang of how this forum works. I know not to bump an issue too. Anyway. What you said above

    it seems to me that it might be best to leave at least part of it in a separate file.

    seems to be true. I replaced the call to the file ‘submitRating.php’ from the javascript file and left the class in the functions.php file and everything worked fine. Should I post the entire php class in the bin or just certain lines? Thanks again for helping.

    Thread Starter tsalagi

    (@tsalagi)

    Let me try this again. Since I didn’t explain the issue to well last time and I think apljdi gave up on me.
    I have a star rating package that is not a plug in. The package has three files that interact with each other from a template file created by me under a WordPress theme.
    One of the tree files is a php file that holds a php class. with all the needed functions. I copied the class and placed it in my functions.php file so it could be called from my template file.
    The second file is a text file that gets ip addresses and rating scores written to it by the php class.
    The third file is a javascript file that is called by the header of the template file and also has a function that submits the rating to the class in the functions.php file which then writes to the results.txt file.
    Okay. The first thing I did was copy the class into the functions.php file and theen fired up the package with a call from my template file with this line of code.
    ‘<?php $handler->displayRating(‘Book1′,5); ?>’
    which creates a new class for rating but threw this warning on my page.

    Warning: Invalid argument supplied for foreach() in wordpress/wp-content/themes/mytheme/functions.php line 26

    which is this line of code.
    ‘foreach ($fileContent as $line) {‘.

    I traced the code back to the creation of the $fileContent variable which had it’s roots in this line of code that creates a class variable with the results.txt file as the value.
    ‘var $RATES_RESULT_FILE = “results.txt”;’
    I then changed that line to this.
    ‘var $RATES_RESULT_FILE = “wp-content/themes/mytheme/results.txt”;’ with the result of no error and the rating blocks being displayed. As I tested I realized I was able to vote more than once which was a bug. In the javascript file there is a function that controls the submit rating action. Within this function I found that it had a line to open the original file that stored the php class which I had copied to the functions.php file. Here is the original line of code.
    ‘httpObject.open(“GET”, “submitRating..php?item=”+item+”&rating=”+rate+”&max=”+max, true);’
    I changed it to this line of code.
    ‘httpObject.open(“GET”, “https://localhost/wordpress/wp-content/themese/mytheme/functions.php?item=”+item+”&rating=”+rate+”&max=”+max, true);’
    I reloaded my page without error. I moused over the rating block no error. I clicked on the rating block and got two warnings.

    Warning: fopen(wp-content/themes/mytheme/results.txt) [function.fopen]: failed to open stream: No such file or directory in C:\wamp\www\wordpress\wp-content\themes\mytheme\functions.php on line 107

    Here is line 107
    ‘$f = fopen($this->RATES_RESULT_FILE,”a+”);’

    Warning: Invalid argument supplied for foreach() in C:\wamp\www\wordpress\wp-content\themes\mytheme\functions.php on line 26

    Now we have come full loop with the same error I started out with due to this line of code.
    ‘foreach ($fileContent as $line)’.
    Sorry this is so envolved. I just wanted to be clear and concise. I would paste more of the code but I was told not to paste large blocks of code here.
    All I’m really trying to achieve here is to learn about WordPress and how it deals with paths and how I can deal with such issues in the future. If I wanted to go the easy route I would just get a plugin.

    Thanks in advance if you can help or willing to try

    Thread Starter tsalagi

    (@tsalagi)

    Is this– var $RATES_RESULT_FILE = TEMPLATEPATH . ‘/results.txt’;– part of a javascript function?

    No it’s part of the class located in the functions.php file.

    Thread Starter tsalagi

    (@tsalagi)

    Well It was working until I realized that the javascript wasn’t working correctly as it was letting me vote several times and not updating. So I wrote a direct path from the javascript file using
    httpObject.open("GET", "https://localhost/wordpress/wp-content/themes/modernscribe/functions.php?item="+item+"&rating="+rate+"&max="+max, true);
    Then I got this error
    Warning: fopen(wp-content/themes/modernscribe/results.txt) [function.fopen]: failed to open stream: No such file or directory in C:\wamp\www\wordpress\wp-content\themes\modernscribe\functions.php on line 107

    Warning: Invalid argument supplied for foreach() in C:\wamp\www\wordpress\wp-content\themes\modernscribe\functions.php on line 26
    Sorry I didn’t include all that earlier.

    Thread Starter tsalagi

    (@tsalagi)

    Here is the call from the javascript file that lives in a js folder

    httpObject.open("GET", "https://localhost/wordpress/wp-content/themes/modernscribe/functions.php?item="+item+"&rating="+rate+"&max="+max, true);

    Here is the referance to the text file that is a writable file to write rates and ip addresses to. The way I’m using it now and it works.
    var $RATES_RESULT_FILE = "wp-content/themes/modernscribe/results.txt";
    Here is the way I tried to do it using TEMPLATEPATH:
    var $RATES_RESULT_FILE = TEMPLATEPATH . '/results.txt';

    Thread Starter tsalagi

    (@tsalagi)

    I’ve tried TEMPLATEPATH but that didn’t work. Maybe I didn’t use the correct syntax.
    Along the same subject there is a line in the javascript that calls the class from the functions file and I don’t know how to get there regarding the path issue. If you can help I’d appreciate it.

    Thanks

    Thread Starter tsalagi

    (@tsalagi)

    Thanks for the encouragement.

    Thread Starter tsalagi

    (@tsalagi)

    t31os_. That was exactly what I was looking for.

    Each PHP function and WP function has an associated document (songdogtech provided one for WP_Query), but i don’t think you’ll make any sense of them without reading through each (it would be a little like explaining what a steering wheel is to someone who has no idea what a car is)… bad analogy aside, hope that helps..

    . As I am studying both WP and PHP I have been referring to both set of documents as I want all of the details I can get. Sometimes a breakdown like you provided makes the clouds part and lets the light of the code shine through.
    Thanks again.

    Thread Starter tsalagi

    (@tsalagi)

    I’m aware of the codex. Thank you. I”m looking for a more down-to-earth breakdown.

Viewing 15 replies - 31 through 45 (of 60 total)