URL link issues - php

Sorry for the title as I really have no idea what to call this.
Though with the template i've got it has links of like: index.php#home [it takes me to the class id of "home" instead of reloading an actual full page. Anyways i'm intergrating a script into it which has a blog. and for the blog its link is view.php?id=1
Anyways my panel I want it to take me is called blogp though in blogp it reads the url and finds out the id example index.php?id=1 and it takes me to the blog post with the id 1. I'm just wondering how I'd do it now that i'm using #blogp
My attempts:
index.php#blogp&id=1
index.php#blogp?id=1
But none work.

Related

Links in blog posts

Consider this link
https://meta.stackexchange.com/questions/21657/what-did-the-original-stack-overflow-look-like
As you can see this is a link to a StackExchange page. This has a pattern in it like www.websitename.com/title_of_the_page. How does this link open up a answer page? Is there a folder called title_of_the_page or how to write a PHP script that can get this title_of_the_page from the link?
No there is not any folder called the title of the page and should not be. It's all about rewrite rule. The number you are seeing in the link is the actual id of the question which is the main thing in the url. If you only use the id like
https://meta.stackexchange.com/questions/21657
it gets redirected to the original url. Consider reading this article:
https://www.tinywebhut.com/redirect-all-urls-to-proper-version-of-urls-38
Moreover, this is the best practice for Search Engine Optimization(SEO).

Multiple pages for custom_post_type posts

I have a custom_post_type that creates the posts for campaign_posts, they are displayed singularly on the front-end of my site with the page template single-campaign_posts.php.
Now, what I am trying to achieve is;
single-campaign_posts.php displays the post (already taken care of)
A second page that will display a frontend editor of the post (contents of this page is already taken care of
A third page that will display analytics for the post (again, the contents of this page has been taken care if)
So when a post is viewed they can click a link within single-campaign_posts.php to display either the analytics page or edit page. The pages that are linked to must be;
able to recognize that the contents of that page relate to the post
the URL slug is for example if the post was /campaigns/dummy-post would be /campaigns/dummy-post/analytics for the analytics page and /campaigns/dummy-post/edit-campaign for the edit page.
I have tried using nav tabs to do this and it works, however, I would rather have the contents on separate pages.
I hope this enough information to obtain my goals in this. I cannot see much point in adding details of the functions.phpor single-campaign_posts.php but if they are required then please let me know.
I hate seeing posts like this, but I have come up empty on searches for a solution. In its very basic form, I need three pages that all relate to the single post.
Thank you for your time and if you need more information please let me know.
I have found the solution to this now.
The solution was to use Rewrite API/add rewrite endpoint as seen Rewrite API/add rewrite endpoint
An example is posted in this question - Create Post tabs in single-{content-type}.php with Custom Field values

PHP redirect/disguise URLs

I have a page which receives a parameter and uses it to load it's content.
Let's say the url is www.myweb.com/category.php?name=shampoo. What I want is the URL to display www.myweb.com/shampoo, and that when some user types www.myweb.com/shampoo it actually loads www.myweb.com/category.php?name=shampoo but the url keeps displaying www.myweb.com/shampoo.
Same thing with, per example, www.myweb.com/category.php?name=soap displays as www.myweb.com/soap
Is this posible with php? I have made some research but I has not been able to find anything. Thank you very much.

Updatig URL and content with AJAX, and also making that link works without AJAX

I want to make my website have page navigation like Facebook does. I mean when click a link on Facebook from the navigation bar on the left side(News Feed, Pages, Lists etc.) only Facebook content flow, advertising side bar changes(in short, middle and right columns) and URL changes. No page redirection happens.
One thing also, I have learned that you can change URL with History API but, how is it possible to make when another person uses that link and you make them to get into that page? For instance, you have index.php and profile.php. In index.php you have navigation bar, and a few good basic items you never change. When you load profile.php into a on index.php with AJAX and change the URL to www.example.com/profile.php from www.example.com/index.php its ok.
However if someone else uses that link later, how i am going to merge index.php and profile.php? I dont have navigation bar in profile.php, I only have the AJAX info to use inside index.php.
SCREENSHOT: http://tinypic.com/r/idsjsh/8
I hope I explained everything clearly. I am really wondering how facebook achieves this.

when doing a 'like' on one of our page, the 'like' is posted twice

We just implemented a Facebook like button everywhere on our site. However, it works a little bit weird on one of the pages.
If you click on the like button anywhere and then write a comment, it only posts once on Facebook. This is the correct behavior.
Unfortunately, on the another page it creates two items on your Facebook wall.
Has anybody previously seen the same problem on any site?
I use an iframe, and the link is what I call there:
www.facebook.com/plugins/like.php?href=%s;send=false&layout=standard&show_faces=false&;action=like&colorscheme=light&font=arial&height=35&appId=%s
The first %s is the current URL, the second %s is an appid.
Its a common bug, ive got a facebook like box too. And when i like my own page it will be liked twice. You cant do anything about it. Other visitors who like your page will only show up once.

Categories