Change page title with PJAX? - html

I'm using PJAX with cakePHP. Everything works super fine, but since I'm not reloading the layout, I don't get title update. I was told I had to put a tag in the body, and that it would get removed. It seems to work but, is it valid to have an HTML page without a tag ?
EDIT : well actually the tag isn't removed, so HTML markup is invalid! What is the best practice for this? It would need to be the same for metas.
The official demo uses this in Ruby but I don't read it :
https://github.com/defunkt/jquery-pjax/blob/heroku/app/pjax.rb
https://github.com/defunkt/jquery-pjax/blob/heroku/app/views/layout.erb

Since #57 pjax also looks for a data attribute data-title in the fragment that is loaded and should update the main title.
This is much cleaner and would not break html with a title in the body.

Related

Go to link within same webpage in Angular

I'm just starting angular and am able to display the homepage via the url: http://localhost:8002/app/#/home
Now, I want to use a name tag, to go to 'FAQ' section within the same page by using:
FAQ and <section id="faq">
However, this is not working. Can anyone please guide me here ?
You can also use $anchorScroll (better solution). You can see an sample and more details here. I don't test ng-href but i think it is bad solution.
You should write in the href attribute #/faq, with a slash.
and another issue, is using ng-href, as written in angular docs(https://docs.angularjs.org/api/ng/directive/ngHref):
Using Angular markup like {{hash}} in an href attribute will make the link go to the wrong URL if the user clicks it before Angular has a chance to replace the {{hash}} markup with its value. Until Angular replaces the markup the link will be broken and will most likely return a 404 error. The ngHref directive solves this problem.

Magento Product Attribute Keeps Displaying HTML

I am adding a product attribute onto my product pages in Magento Enterprise V 1.14.1 and I can't get the HTML to display as it should on the frontend. I have WYSIWYG disabled with the 'Allow HTML Tags on Frontend' set to yes and have confirmed in my PHPAdmin databases that it is set to 1, but on my product page it is still displaying the raw HTML.
On the same page I have attributes which point to a static block with HTML and those display as they should, but this attribute which uses a text field doesn't seem to want to display correctly.
This is the code I am using to call my attribute in case that is where the issue is lying where 'static_block' is the name of my attribute I'm trying to call:
<?php echo $this->htmlEscape($_product->getData('static_block')); ?>
And what's weird is when I enable 'Visible on Product View Page on Front-end' and it appears in the 'Additional Information Tab' it displays as it should. So I'm guessing there might be something wrong with my script which is calling the attribute.
Thanks for the help!
It appears to be converting the html into Escaped HTML, which I do not think you want in this case. Try without htmlEscape() wrapping the static_block.
<?php echo $this->$_product->getData('static_block'); ?>
--- 11/10/2014 13:00 EST
It now appears you are calling an array for echo, rather than individual elements of an array.
--- 11/10/2014 13:15 EST
I stripped the HTML, used an HTML cleaner and, using Google Chrome's Edit HTML feature, I stripped out the quoted block and pasted the cleaned HTML and it worked perfectly, which pretty much confirms the Escaped HTML is to blame. It is reading <div> rather than <div> for instance.
echo $this->$_product->getData('static_block');
please use this code

How to skip <p> tag in HTML?

I'm trying to use CKeditor as Wysiwyg editor for my blog posts. It works fine, all my contents get inserted fine in DB.
However I have one problem. CKeditor inserts automatic <p> tag in the begining, which mess up my code while returning from DB.(I loose CSS stylings).
Therefore, I'm wondering is there a way to tell HTML to ignore(skip) that tag (and closing one in the end).
Thank you...
You need to change the configuration file (plugin.js) to this: config.autoParagraph = false;
Whether automatically create wrapping blocks around inline contents inside document body, this helps to ensure the integrality of the block enter mode.
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.autoParagraph

HTML page title: localization and empty title

2 questions about a better way of solving the problem:
1) is there is a way to make HTML page title looking different for different locales of the client-side code except for javascript?
I.e. write HTML page title which is shown in the browser's tab in corresponding language.
I know I can use javascript for this, but may be there is another way?
2)I set my HTML page header with javascript (it is a different case). But there is a delay before the script will run. Is there is a way to set HTML page header to empty line before javascript evaluates?
If I remove tag I get the page URL.
If I use empty tag - same thing.
I have to use &nbsp content inside which looks a bit ugly.
Some other options?
I don't see any other means but JavaScript on the client side for this, sorry.
For the delay: try using an inline javascript to change the page title right on top of the page before any other scripts are loaded or executed, but after the page title has been set. This should keep the delay to an absolute minimum.
To the first:
Except Javascript, the only Way i know would be PHP, but using Javascript is a lot better and
easier.
To the second:
arkascha's Post is the answer

How do you modify wordpress css for posts?

So, Im using wordpress.com to run my blog. I have paid for the upgrade with custom css. Now I want to change the formatting of posts that are on the front page. Ive been using the "inspect element" on Chrome, simular to Firebug, to see what class everything has and changing the CSS.
Its been pretty easy other than the posts. Each post, apparently has its own class.
my latest post is of class="post-190"
However, the post before it is class="post-188"
etc...
How do you write a CSS to include all of the post-##
You can use these attribute selectors
[class|=post]
an element whose "class" attribute has a hyphen-separated list of values beginning (from the left) with "post"
[class^=post]
an element whose "class" attribute value begins exactly with the string "post"
Source
From the basic TwentyEleven Wordpress theme let me suppose that you want to add border to this post, the structure of this class is forming from the wp-includes/post-template.php file.
This method is creating the class for this post -- get_post_class()
And then add styling to my content-aside.php page in the template, i hope this is what you are looking for, ley me know if u have an issue.