Days
Hours
Minutes
Seconds

Super Black Friday Sale!

0
No products in the cart.

Forum Replies Created

Viewing 15 posts - 721 through 735 (of 741 total)
  • Author
    Posts
  • in reply to: Triggering FancyBox from a DIV onclick(); #10129
    blankabctest483
    Member

    a) you can put other items inside an a tag, it will work but it’s unsemantic.

    b)

    1. put your iframe in a hidden div (or ajax it in on click)
    2. the do $(‘.menuitem’).click(hiddendiv.fancyb…().show())

    Personally i would always avoid using onclick=”” it’s much easier to maintain your code in an external js file

    in reply to: Recommended way to embed PDF in HTML? #9330
    blankabctest483
    Member

    You can also use Google PDF viewer for this purpose. As far as I know it’s not an official Google feature (am I wrong on this?), but it works for me very nicely and smoothly. You need to upload your PDF somewhere before and just use its URL:

    <iframe src="https://docs.google.com/gview?url=http://example.com/mypdf.pdf&embedded=true" style="width:718px; height:700px;" frameborder="0"></iframe>
    

    What is important is that it doesn’t need a Flash player, it uses JavaScript.

    in reply to: Retrieve WordPress root directory path? #9950
    blankabctest483
    Member

    Note: This answer is really old and things may have changed in WordPress land since.

    I am guessing that you need to detect the WordPress root from your plugin or theme.
    I use the following code in FireStats to detect the root WordPress directory where FireStats is installed a a WordPress plugin.

    function fs_get_wp_config_path()
    {
        $base = dirname(__FILE__);
        $path = false;
    
        if (@file_exists(dirname(dirname($base))."/wp-config.php"))
        {
            $path = dirname(dirname($base))."/wp-config.php";
        }
        else
        if (@file_exists(dirname(dirname(dirname($base)))."/wp-config.php"))
        {
            $path = dirname(dirname(dirname($base)))."/wp-config.php";
        }
        else
            $path = false;
    
        if ($path != false)
        {
            $path = str_replace("\\", "/", $path);
        }
        return $path;
    }
    
    in reply to: Retrieve WordPress root directory path? #9952
    blankabctest483
    Member

    Looking at the bottom of your wp-config.php file in the WordPress root directory will let you find something like this:

    if ( !defined('ABSPATH') )
        define('ABSPATH', dirname(__FILE__) . '/');
    

    For an example file have a look here:
    http://core.trac.wordpress.org/browser/trunk/wp-config-sample.php

    You can make use of this constant called ABSPATH in other places of your WordPress scripts and in most cases it should point to your WordPress root directory.

    in reply to: Create a folder if it doesn't already exist #10820
    blankabctest483
    Member

    Use a helper function like this:

    function makeDir($path)
    {
         $ret = mkdir($path); // use @mkdir if you want to suppress warnings/errors
         return $ret === true || is_dir($path);
    }
    

    It will return true if the directory was successfully created or already exists, and false if the directory couldn’t be created.

    A better alternative is this (shouldn’t give any warnings):

    function makeDir($path)
    {
         return is_dir($path) || mkdir($path);
    }
    
    in reply to: Create a folder if it doesn't already exist #10822
    blankabctest483
    Member

    Try this, using mkdir:

    if (!file_exists('path/to/directory')) {
        mkdir('path/to/directory', 0777, true);
    }
    

    Note that 0777 is already the default mode for directories and may still be modified by the current umask.

    in reply to: Recommended way to embed PDF in HTML? #9327
    blankabctest483
    Member

    Have a look for this code- To embed the PDF in HTML

    <!-- Embed PDF File -->
    <object src="YourFile.pdf" type="application/pdf" title="SamplePdf" width="500" height="720">
        <a href="YourFile.pdf">shree</a> 
    </object>
    
    in reply to: JQuery – $ is not defined #9731
    blankabctest483
    Member

    I use Url.Content and never have a problem.

    <script src="<%= Url.Content ("~/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>
    
    in reply to: JQuery – $ is not defined #9738
    blankabctest483
    Member

    Are you using any other JavaScript libraries? If so, you will probably need to use jQuery in compatibility mode:

    http://docs.jquery.com/Using_jQuery_with_Other_Libraries

    in reply to: Why is Magento so slow? #9860
    blankabctest483
    Member

    If you haven’t seen it yet, Magento and Rackspace teamed up to create a white paper on performance tuning Magento. It’s excellent.
    https://support.rackspace.com/whitepapers/building-secure-scalable-and-highly-available-magento-stores-powered-by-rackspace-solutions/

    — edit —

    Another great resource, newly available (Oct 2011) is:
    http://www.sessiondigital.com/assets/Uploads/Mag-Perf-WP-final.pdf

    (Thanks due to Alan Storm on this one.)

    in reply to: How can I change an element's class with JavaScript? #9700
    blankabctest483
    Member

    The line

    document.getElementById("MyElement").className = document.getElementById("MyElement").className.replace(/\bMyClass\b/','')
    

    should be:

    document.getElementById("MyElement").className = document.getElementById("MyElement").className.replace('/\bMyClass\b/','');
    
    in reply to: Why is Magento so slow? #9861
    blankabctest483
    Member

    Further to Alan Storm’s recommendations on caching, there’s two things I’d specifically recommend you look into related to caching:

    – Make sure caching is in memcached, rather than on disk.

    I look after a couple of magento installs, and once you get any sort of load on the system, memcached starts to perform much faster. And its dead easy to change it over (relative to doing other magento stuff at least!)

    Good starting point is here: http://www.magentocommerce.com/boards/viewthread/12998/P30/ – but if you’ve not used memcached at all before, its worth looking at some general info about it as well.

    – Enable template/view caching.

    This is a good article: http://inchoo.net/ecommerce/magento/magento-block-caching/

    There are good ones on the magento site too (google magento block caching), but its down at the moment.

    To add my two cents to the block caching, I’d advise you create your own blocks in /app/code/local, extending the core ones and defining the cache parameters, name them xxx_Cache and then update your layout to use these blocks instead of the core ones. This way, you avoid losing your changes or breaking the system when you upgrade magento.

    in reply to: Why is Magento so slow? #9862
    blankabctest483
    Member

    I’ve only been tangentially involved in optimizing Magento for performance, but here’s a few reasons why the system is so slow

    1. Parts of Magento use an EAV database system implemented on top of MySQL. This means querying for a single “thing” often means querying multiple rows

    2. There’s a lot of things behind the scenes (application configuration, system config, layout config, etc.) that involve building up giant XML trees in memory and then “querying” those same trees for information. This takes both memory (storing the trees) and CPU (parsing the trees). Some of these (especially the layout tree) are huge. Also, unless caching is on, these tree are built up from files on disk and on each request.

    3. Magento uses its configuration system to allow you to override classes. This is a powerful feature, but it means anytime a model, helper, or controller is instantiated, extra PHP instructions need to run to determine if an original class file or an override class files is needed. This adds up.

    4. Besides the layout system, Magento’s template system involves a lot of recursive rendering. This adds up.

    In general, the Magento Engineers were tasked, first and foremost, with building the most flexible, customizable system possible, and worry about performance later.

    The first thing you can do to ensure better performance is turn caching on (System -> Cache Management). This will relieve some of the CPU/disk blocking that goes on while Magento is building up its various XML trees.

    The second thing you’ll want to do is ensure your host and operations team has experience performance tuning Magento. If you’re relying on the $7/month plan to see you through, well, good luck with that.

    in reply to: How to prevent line breaks in list items using CSS #10101
    blankabctest483
    Member

    Use white-space: nowrap;[1] [2] or give that link more space by setting li‘s width to greater values.


    [1] § 3. White Space and Wrapping: the white-space property – W3 CSS Text Module Level 3
    [2] white-space – CSS: Cascading Style Sheets | MDN

    in reply to: How do I get PHP errors to display? #10182
    blankabctest483
    Member

    You can’t catch parse errors in the same file where error output is enabled at runtime, because it parses the file before actually executing anything (and since it encounters an error during this, it won’t execute anything). You’ll need to change the actual server configuration so that display_errors is on and the approriate error_reporting level is used. If you don’t have access to php.ini, you may be able to use .htaccess or similar, depending on the server.

    This question may provide additional info.

Viewing 15 posts - 721 through 735 (of 741 total)