PHP link navigation inside link navigation - php

I created a simple webshop with PHP. The header, footer and navigation is fixed and when I click through the navigation only the main area changes and the link changes too (for exaple index.php?page=shop).
Now I want to use pagination for the articles. Every time I click on another page it will change the link too (for example index.php?page=shop?id=5). The id is the page number. But this doesn't work in PHP. It always links me to the start page.
Does anybody know how to do this?

There are only one single question mark in URL in place of two when u pass more than two parameters in URL it should be
index.php?page=shop&id=5

Like arkascha said , index.php?page=shop&id=5 then you get this parameter with $_GET['id'] , check if isset and load next pag.

Related

Wordpress: changing only one page url from database

In Wordpress I created a page "home" (https://sitedomain.com/home) but I cannot render it equal as the homepage (I made a page template equal to index.php and implemented the custom query but still not working properly).
I currently have a
echo("<script> window.location.replace('https://sitedomain.com')</script>"); statement in the single page template file allowing me to redirect users to the actual homepage but it is slow. I want to manually change the URL of this page in the database but I cannot find it in the Database.
Also, it is not possible to modify the URL from the dashboard since the minimum url must be https://sitedomain.com/home.
Is it possible? Where to find the single URL of the page in the Database?
You can just define that page as your homepage in the WP dashboard: "Settings > Read > select static page as starting page" (or similar, not sure about the exact English terms)
in the end I simply used JQuery to replace the href attribute with the one that I needed (https://sitedomain.com).
Not ideal solution but it works.

Iframe target parent not working

I'm doing a website that is a more actual menu than the actual one, and I'm just using iframes to organize the content.
When you click on an item of the menu, it has a link to the same webpage with a get parameter, where there is a switch option that read the param and print the correct iframe.
The problem is that when I go to some menu and this menu has different options, it is printed the first menu with some link and, when I clik on one of these links, I'm redirected to correct website but in a new window. Is it possible to be always in the same window?
I have just tried with or "_self" but it is not working. The server is the same for both websites but they are located on different folders, so I'm using absolute paths because is easier (My idea is to implement it and later improve step by step).
Thanks!
If you want to update what is inside an given iFrame, than the iFrame needs a name (be sure to use a unique name) and the link that's supposed to update your iFrame needs a target.
Here's an example:
<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
<p>W3Schools.com</p>
If you want to update the parent page (the one, that has the iFrames in it), then use target="_parent" within the <a>-tag.
_self is the frame or window, that the link is called from.

Extra code add at end of the url in wordpress?

I'm using the Wordpress CMS to make a site but I face a problem with Wordpress' url create.
When I click on page link, the page url looks like this:
http://example.com/page/?ID=603#
After some time the page url looks like this:
http://example.com/page/?ID=603#.USY_Xx1HI1M
I can't understand how to add this code .USY_Xx1HI1M at the end of the url.
So guys, if you have any solution for this problem, please share with me.
There is a two ways to remove the hash tag from the URL.
1) In the script, there is a property which control to display hashtag or not. Just set 'hashAddressBar: false'
2) When generating a code for the button there is a radio button saying 'Track when users share by copying your URL' so just uncheck this and it wont generate hast tag for URL.
If you used addthis, double check that you have set data_track_clickback and data_track_addressbar to false, you can read more here: https://www.addthis.com/academy/removing-hashtags-anchors-and-tracking-codes-from-your-urls/

adding a new article in joomla

I have 2 pages (say A and B)
If I add an article on page B I would like to display a short href item in page A that takes me to the just added article on page B. I am doing this using Zoomla (and php - well not yet php)
Thank you for any idea and guidance
You can just add it with manually with following steps..
just copy the url of the page B like index.php?xxxxxxx to the end so that after enable rewrite remain work..
and then paste the link on the page A article..

JavaScript - Basic URL rewrite + creating record in history

Here's the situation.
I have a site where clicking hyperlinks within a certain div makes a jQuery function get the content of a div from a separate page. Because of this, the URL don't change. I need it to change as well as writing an entry in history.
My pages are setup like this (not sure this is the smartest way of going though)
access.php (main logon)
new-user.php
forgot-pass.php
index.php
controlpanel.php
etcetc. Now, all of these pages are reachable on their own and are mainly identical and all contain a div called "container". When clicking links, the content from this div gets erased and the content from the coresponding div (container) gets loaded from the file of the URL (href). I'm terrible at explaining..
So basically, what I need is some javascript that picks up the href link address and just pastes it in the url bar at the same time as it creates an entry in history so the back and forth buttons work.
I plan on extending this in a while as well, translating query strings as well. But there are a few constant static pages I need to take care of first. Any help would be very appreciated! :)
You are not allowed to change the entire URL by JavaScript but you can use URL hashes. I recommend you the browser history plug-in. You can simply register a handler to react on URL changes and load your corresponding content via ajax.
Have you looked at the jquery address plugin? Look at the examples. Is this similar to what you want?
It's not possible with "normal urls" (we must wait for a new generation of browsers...)
But there is a "trick": playing with anchors.
A link like "same_page.php#anchor" does not reload the page, but act on both the history and the adress bar.
So, if instead of having url like "page.php?param=lorem", you could have "page.php#param=lorem", you have your solution :)

Categories