Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7500751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:17:24+00:00 2026-05-29T20:17:24+00:00

I’m currently creating my own CMS and I have a hard question (I think

  • 0

I’m currently creating my own CMS and I have a hard question (I think it is) and I can’t found anything on Google…

I’m trying to make a edit_settings.php with AJAX and PHP, to include my Zend_Config_Ini into it ’cause I’m using this for my config.ini parsing and writing.

There’s is the base of the PHP code (my array isn’t there, normal):

<?php
$config = new Zend_Config_Ini('config.ini',null,array('skipExtends' => true, 'allowModifications' => true));

// Write the config file
$writer = new Zend_Config_Writer_Ini(array('config' => $config,'filename' => 'config.ini'));
$writer->write();
?>

Exemple: I click on “Edit” and the red-bordered zone become a input field and I can edit it without changing page and I just need to click “Save” after to save the config in the config.ini file.

CMS Admin

I know that this needs AJAX, PHP and the Zend_Config_Ini but I don’t know how to link them together…

The question: HOW I CAN DO THIS?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:17:28+00:00Added an answer on May 29, 2026 at 8:17 pm

    I wouldn’t go with the whole page refresh thing. It adds additional logic to the controller. Logic which could be easily be in specialized ajax controllers. And jQuery’s AJAX is cool. And AJAX is perfect for edit-in-place stuff.

    I’ll make the following assumptions:

    • you use jQuery

    • you know that a valid JSON string becomes a JS object in jQuery

    • you have an AjaxController with a “settingsEditAction”

    • you know that this is my take on your problem, not imposing any style of
      thinking or even of coding; this is how I would do it, so it’s bad
      or good.

    • you know I’ve written this in np++, off the top of my head, so you won’t freak out on missing colons or the like

    In AjaxController:

    public function settingsEditAction()
    {
        $json = array('success' => false);
    
        $inputName = $this->_getParam("inputName");
        $inputVal  = $this->_getParam("inputVal");
    
        // all OK?
        if (!$this->_request->isXmlHtmlRequest() || 
            !$this->_request->isPost() ||
            is_null($inputName) ||
            is_null($inputVal)) 
        {
            $this->_helper->json($json);
        }
    
    
        $iniWriter = new Zend_Config_Writer_Ini();
    
        // modify ini with according to input name and value; sanitize before writing
    
        // I haven't use an ini writer, but if the write() method returns a boolean,
        // store it in the success key
        $json['success'] = $iniWriter->write()
    
        $this->_helper->json($json);
    }
    

    The jQuery part:

    $(document).ready(
    
        // say we have <p class="edit">edit</p><p>Value</p>
    
        // on click "edit", do DOM manipulation to turn into <p class="save">save</p><input name="inputname" value="some value" />
    
        $("p.save").on('click', function() {
    
            // somehow get the above input; I'm using it as a sibling; use "parents" or "children" etc.
            $input = $(this).siblings("input"); // $(this) is the current clicked element (<p>)
    
            // create data container to send to ZF
            var ajaxObj = {
                'inputName': $input.attr("name"),
                'inputVal': $input.val()
            };
    
            // manage the response as a JSON
            var callback = function(json) {
                if (json.success) {
                    // change from input text to <p> to simulate edit-in-place
                } else {
                    // alert? show error markup?
                }
            };
    
            // Remember "settingsEditAction" in the "AjaxController"? That's "settings-edit" in URL-speak as per ZF conventions
            // The last param is the data type you expect from server
            // Use POST for posting, GET for getting, what?
            $.post('/ajax/settings-edit', ajaxObj, callback, 'json');
    
        });
    
    );
    

    LE:
    Actually, I’ve missed the part in which you click edit, and the p turns into an input.
    Click edit: 1st p has “save” as text, and the sibling p becomes an input.
    Click save paragraph: send post; if success, set the original markup (2 <p>‘s).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.