WP Multisite get current page from other Blog - php

I have a wordpress page where i have Menu Items, content and more.
Now the idea is to have two domains they can go to:
The default one: link.de/page
And a second one at: blog.link.de/page
The plan is, that the second domain has the same contents as the default one. The only thing that would be different is the domain people will would be on.
This is the hard part, i must include the content from the default page here.
Step 1 was, include the Menu from the default one and change the links via Walker.
Now i need ideas how i can display the content from a page which has
the same name as the current.
If you think "why you need multisite, when the content is the same"
The content can be change, when the current page exists on the current blog
Hope you can help me...

You could use a CNAME record for this:
That CNAME could point to the original server. And when you point a CNAME, you also directly have that subdomain.
You should also set your site home and base url to the url of the main website so that if you click on something in the second one it leads you to the main domain. And not to a dead page.
Hope that works.
Source(Shold definitely read):
https://premium.wpmudev.org/forums/topic/how-to-point-domains-to-mapped-wp-multisite-subdomains?utm_expid=3606929-92.rprqzZQVQVO9C0D8ZR2AsQ.0&utm_referrer=https%3A%2F%2Fwww.google.nl%2F

Related

CodeIgniter: Inside a controller-class can't go back to pages in one level higher

I am new to web development. I am using CodeIgniter 2.1.4 framework and WAMP server for testing.
I have followed the tutorial to create the News section, and added some link on the header.php to go to Home, About, and News.
All the links work perfectly on the main page and the News page. But once i go into News view page. All the link are broken.
For example, at the home page, all the link will point to
localhost/test/home
localhost/test/about
localhost/test/news
but once i go into News view page, all the link become
localhost/test/news/home
localhost/test/news/about
localhost/test/news/news
I am not too sure what i did wrong or missed.
Try adding a leading / to your links and referencing everything starting from the root of your domain.
Example:
a href='test' gets you www.yoursite.com/(yourdir)/test
a href='/test' always gets you www.yoursite.com/test

Wordpress site not fully moved

I have moved a wordpress site from /wordpress/ to / and it has worked except for the header navigation bar.
http://vashonschoolsfoundation.org/thank-you/annual-report/
If you click on of the top links (not one of the dropdown links), it takes you to a /wordpress/ url.
IE: if you click Thank you, it should take you here,
http://vashonschoolsfoundation.org/thank-you/annual-report/
but instead it takes you here:
http://vashonschoolsfoundation.org/wordpress/thank-you/annual-report/
The correct url (without /wordpress) works, but it isn't the one getting linked to.
All the submenu links work fine.
How can I fix this?
Note: when you hover over the top links, they say they will take you to the right links (in the url preview browser feature in most browsers), but they take you to the wrong (/wordpress) one.
I see that only two top navigation links redirects to /wordpress/ ('Thank You' and 'Contribute'). 'About' and 'Contact us' works correctly.
When clicking on 'Contribute' server sends Location header - Location:http://vashonschoolsfoundation.org/wordpress/contribute/give-today/
This header is set somewhere in you code or options that are saved in database. I don't think that the problem in database, because in this case all links will be broken.
Try to disable all plugins, switch to default theme and check the links.
Have you changed the "site address" in your Wordpress general settings?
Did you just move the files one directory up? Because there is more to it than just that. I've used these detailed instructions a few times to move Wordpress installations.
Dump your wordpress DB and then search replace old URL from the dump and then drop your current db and then import the corrected one.
Do you still have an wordpress under /wordpress/ folder?
All you need to do is make two changes in your database table wp_options
All you have to do is change the option_value field to the correct URL for the records with option_name=’siteurl‘ or option_name=’home‘.
Read the instructions in the Codex.

PHP - Replace page ID selected from MySQL database with alias name in URL

Not sure if title explains my problem well...
I have a site with a lot of pages (I call them "sections"). When users click on a page link, PHP script selects section content and infos from MySQL database, and show them to user. To avoid the display of section ID in browser addresses bar (the page is loaded through the knowledge of section ID in database), there is one different file associated to each section. In these files, PHP code passes ID to $_GET variable, and script loads section. The displayed URL is so http://site_domain/path/to/file_name.php.
Is there a way to avoid the creation of real file and to show, for example, an alias in URL? I thought to add a new column "alias" in database table sections to replace it in URL.
Hope my English and the explanation is clear...
I think you can create some sort of general controller which is a page, lets call it index.php and in that page you can pass some information about the section on your website through some GET parameter.
For example: http://andreswebsite.com/index.php?section=home
And then in your index.php code you can redirect the user to that specific section. You can have the section name in your database so no need to pass the ID.
Also you can look at the Apache mod_rewrite module which I think it could help you (I don't know if you use Apache as your web server)
Here is the documentation: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
I hope this has helped you.

contao CMS - i dont understand link system

I have a problem because I dont't understand system of links in contao (http://demo.contao.org/) but not only in this CMS, Can you help me?
So:
We ALWAYS have link as:
www.something.xx/title-for-example-news.htm,
And the extension is always htm (never php!), no have id of e.g news, is it a good solution? How does it work?
I know way that we have a link for example www.sometking.xx/321-title-for-example-news.htm,
where 321 is id news so we can get easy and fast date from e.g. database, and no colision.
How does it work in contao case? it is fast? Maybe static array of routing? What do you think about it? It looks very pretty but is it fast?
Just came across your question by chance. If you're still interested, here you go.
It's just as fast as the link with the id included. Both systems work by looking up the page name or id in the database; contao stores the permalink in the alias column of tl_page.
There is an issue if you alter the page name / alias though: contao does not have a fallback to the id if the alias is not found, so browsing the old page name returns a 404. This differs from Wordpress, for example. Wordpress will never changes the permalink even if you change the name of the page or post. After all, a PERMAlink should never change!

Concept & Algorithm: How to record only single URL for widget?

I have created a widget for my web application. User's getting code and just pasting that code in their website and my widget works on their website something like twitter, digg and other social widgets.
My widget is on the basis of post, for a single post (say postid: 234) I am providing single widget, so anyone can embed the widget on their website.
Now I want to know that where all my widget is posted and for which post? for that I have recorded the URL of the site when my widget start (onload) but the problem arises when someone placed the widget in their blog or website's common sidebar. I am recording URL each time and hence if it's in sidebar of a blog then it's recording URL for every post which is creating duplicates.
can anyone help on this? How should I go so that I have only one single record for a widget on a site?
I think doing something like this is a bit tricky. Here are some ideas that pop to mind
You could for example ask the user to input their site's URL when they get the widget, or the widget could track the domain or subdomain, thus giving less URLs.
Just tracking the domain would obviously be problematic if the actual site is domain.com/sitename/, and there could be more than one site under the domain. In that case, you could attempt to detect the highest common directory. Something like this:
You have multiple URLs like this: domain.com/site/page1, domain.com/site/page2, and so on. Here the highest common directory would be domain.com/site.
I don't think that will always work correctly or provide completely accurate results. For accuracy, I think the best is to just ask the user for the URL when they download the code for the widget.
Edit: new idea - Just generate a unique ID for each user. This could be accomplished by simply taking the current timestamp or something, and hiding it into the code snippet the user is supposed to copy. This way you can track the ID itself and any URLs and domains it appears in can be grouped under it.
If you have an ID which doesn't get a hit in say week or something you could remove it from your database, and that way avoid filling it up with unused IDs.
I agree with Jani regarding a unique id. When you dish out the script you'll then be able to always relate back to that id. You are still going to have duplicates if the user uses the same id over and over, but at least you'll have a way of differentiating one user from another. Another useful advantage is that you are now able to, as Jani said, group by the ID and get a cumulative number for all of the instances where that user used the script & id.

Categories