Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    Join Date
    Jun 2008
    Posts
    6
    Plugin Contributions
    0

    help question Problems validating my HTML with ampersands in define pages

    Hi
    I am attempting to add some HTML in the main page PHP data area. It works fine but with the following elusive problem.

    I am adding links containing for example: href="http://localhost/~xxxxx/zencart/index.php?page_2=index&cPath=3_10">
    to the area. To be verifiable HTML after downloading, the "&" must be changed to "&".

    On my localhost test installation (Imac) it works fine, allows me to edit and save the change. The downloaded HTML reflects the change and all is well.

    However, On a real server site, I can edit the change but after saving, the change disappears - that is it is removed by the save - other changes are fine like the new path up to the "/index......". The downloaded HTML verifies that the change was not made.

    Is this a character set problem or configuration setting with PHP or MySql or a Zencart setting. What character set should I be using? The SQL connection char set for the server is "utf8_unicode_ci". My localhost shows encoding as "ISO Latin 1". I dont fully understand the relationship here and in particular can I change these without losing data as a trial and error exercise. This is a grey area for me and would appreciate any pointers.

    It seems that the "&" is acting as some sort of escape character but why only on a remote server ??

    Everthing else seems to be working fine. Actually, except for the HTML verify, the change does not seem to be necessary anyway - it performs as expected either way ??

    Regards Paul

  2. #2
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: Problems validating my HTML with ampersands in define pages

    Hi Paul, welcome to the Forum.

    Without getting into the coding pro's & con's of what you mentioned, your problem is not as difficult as it may sound. You will find that you can use the ASCII & as a replacement and it will correctly show within the page output of your Zen Cart store. However, if you go back to make a change the ASCII is gone and it's a regular & again.

    You should be able to confirm this by testing within your site.


    You know, it just dawned on me that you were referring to manually inputted URLs with an & and my statement above is referring to changes within the Categories/Products section of the Admin. I haven't tried using ASCII as you described but shall keep my post as is because it may or may not work for you but will definitely help someone in the future, if they are using the Categories/Products section.
    Last edited by Website Rob; 11 Jun 2008 at 06:25 AM.

  3. #3
    Join Date
    Nov 2006
    Location
    Dartmouth, NS Canada
    Posts
    2,378
    Plugin Contributions
    0

    Default Re: Problems validating my HTML with ampersands in define pages

    I can confirm that what you describe is normal within ZC, when using the define pages editor. It's an irritant, but now that you know, you'll just have to remember to type & instead of & whenever you need one in a URL.

    Rob

  4. #4
    Join Date
    Jun 2008
    Posts
    6
    Plugin Contributions
    0

    Default Re: Problems validating my HTML with ampersands in define pages

    Thanks for the replies folks.

    If it normal with ZC as Rob points out, I still have a problem or maybe the problem is with what I am trying to do.

    The actual problem is that I cant put the "amp;" in define pages. The html I am adding in the main page data includes links to what is normally a menu item link. The only way I found to do this is look at what the normal zencart menus did in the downloaded html and copied that bit if info that includes the "..../index.php?page_2=index&cPath=3_10". This works fine but has the html verification problem.

    One main question is why does it allow me to add the "amp;" when using a localhost but not on a network server ?? It can only be some configuration setting "surely".

    The other thing is that perhaps I am tackling the whole thing wrong and should not be adding this info. However I dont know any other way to add this bit of info to point to the database data I want (a category). Maybe adding menu items as html modifications as I am attempting (for a third party) should not be done - out of the scope for modifications perhaps ?? I do personally believe we should use the facilities provided as much as possible and leave well alone but this is what the "third party" requested.

    If it is stepping out of the bounds of what we can and cannot modify, please tell me and I will look at other options.

    The (test and dev) url for anyone interested is
    www.simply-web.info/demo2/zencart

    The items in question are the icons in the white background on the right.

    Regards.
    Paul

  5. #5
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: Problems validating my HTML with ampersands in define pages

    With an actual URL to go by and from checking things out, seems everything is working as it should.


    www.simply-web.info/demo2/zencart
    The items in question are the icons in the white background on the right.

    Of the 3 icons on the right, one of the URLs use an ASCII ampersand and two do not. The two that do not are what's being picked up as incorrect.

    index.php?page_2=index&cPath=3_10"
    index.php?page_2=index&cPath=3_13"
    index.php?page_2=index&cPath=3_12"

    Change the second two to include an ASCII ampersand as well.

  6. #6
    Join Date
    Nov 2006
    Location
    Dartmouth, NS Canada
    Posts
    2,378
    Plugin Contributions
    0

    Default Re: Problems validating my HTML with ampersands in define pages

    I got you off on a wrong tangent there. I was thinking you were using the define pages editor, but it sounds more like you're doing your edits in the php files themselves. That's a different kettle of fish, to change metaphors in mid-stream.

    Rob

  7. #7
    Join Date
    Jun 2008
    Posts
    6
    Plugin Contributions
    0

    Default Re: Problems validating my HTML with ampersands in define pages

    Rob and others.

    Ok I have an answer to both my problem and a pointer to what is happening I think. Firstly, being new to this I thought the MySql database was involved - it seems it is not - the php file is being updated. (It is now more logical as that is what the "define page editor" implies).

    I found that (even in a localhost) that using "define page editor" to add "amp;" after the "&", in "define_main_page_php" I could add it but the very next time the editor accessed the php file to change anything, the "amp;" was removed by the editor it seems. In a remote server the process varies a bit - I dont fully understand why.

    What I have now done is edit the "define_main_page.php" file directly using my trusty text editor. I can now add what I like and it remains. All seems fine now.
    What I am trying to do with the code may be questionable but that is another issue.

    In summary it seems that this particular problem lays with the "define page editor" itself. A small problem but a problem no less. If the 'define page editor" does what it likes there is an obvious problem.

    Thanks all Paul

  8. #8
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Problems validating my HTML with ampersands in define pages

    With respect to define-pages, Zen Cart doesn't alter the submitted code other than to sanitize slashes.
    Thus, the changing of ampersands must be occurring via the use of one of the rich-text editing tools ...
    You're free to try different rich-text editors if you wish to try out different approaches available.
    Or, you can create your own raw HTML by turning off the rich-text ("HTML Editors") editor and just using "Plain Text" mode.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: Problems validating my HTML with ampersands in define pages

    DrByte, if you refer to post #2 of this thread and do a test, you will see the same thing happen in the Admin > Category/Products section; especially when naming is used.

  10. #10
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Problems validating my HTML with ampersands in define pages

    Why not alter and use the built-in "Always show main categories on home page" facilities that Zen has?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 12 Apr 2011, 07:53 PM
  2. Trouble adding Poll HTML with Define Pages Editor
    By The Enchanted in forum General Questions
    Replies: 7
    Last Post: 13 Mar 2011, 07:20 PM
  3. Issues with HTML area in define pages editor
    By ald0413 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 7 Feb 2011, 04:37 PM
  4. Problems with 3 new pages not dhowing their page define text
    By FoghornLeghorn in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 13 Aug 2009, 02:49 PM
  5. HTML in define pages?
    By lestere1 in forum Basic Configuration
    Replies: 4
    Last Post: 9 Nov 2007, 04:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg